informix 外部表 pipe

文档中:

You can use a named pipe to load data from external tables.

1.创建外部表的时候指定pipe

例子:

create table items(id int, col varchar(10));

insert into items values (1,'row1');

insert into items values (2,'row2');

create external table ext_items sameas items using

(

    datafile("pipe:/tmp/pipe1")

);

2.使用mknod 或mkfifo命令创建named pipes

mknod /tmp/pipe1 p

mkfifo /tmp/pipe1

chmod 666 /tmp/pipe1

3.Open the named pipes with a program that reads the named pipe.

这里下面的方法可以实现

cat /tmp/pipe1 > /tmp/pipe1_1

4.Execute the INSERT statement in SQL.

INSERT INTO ext_items select * from items;

这样数据就会在/tmp/pipe1_1中。

同样的,如果delete from items;

想把外部表的数据insert 到items

需要cat /tmp/pipe1_1 > /tmp/pipe1

insert into items select * from ext_items;

 

posted @ 2020-08-14 14:46  utopia_7  阅读(186)  评论(0编辑  收藏  举报