时间:2021-07-01 10:21:17 帮助过:4人阅读
CREATE TABLE sos.ecui.quotes
(symbol CHAR(5), price INT);
SET NAMETYPE ANSI;
SET SCHEMA sos.ecui;
SELECT * FROM STREAM(quotes);
//This application is in a wait state until rows are inserted into the table.
SYMBOL PRICE
------ -----------
IBM 10
APP 11
>>INSERT INTO quotes VALUES(‘IBM‘,10);
---1 row(s) inserted.
>>INSERT INTO quotes VALUES(‘APP‘,11);
---1 row(s) inserted.
UntilBreake it.
*** WARNING[15033]Break was received.
*** WARNING[15018]Break was received. Thelast statement may be lost.
>>CONTROL QUERY DEFAULT stream_timeout ‘300‘;
--- SQL operation complete.
>>SELECT * FROM STREAM(quotes);
SYMBOL PRICE
------ -----------
IBM 10
APP 11
*** ERROR[8006]The stream timed out, but the cursor is still open.
---2 row(s) selected.
CREATE TABLE ecui.invoices
(contractnbr INT, amount INT, priority INT);
INSERT INTO invoices VALUES(100,10500,1);
INSERT INTO invoices VALUES(200,20390,2);
INSERT INTO invoices VALUES(300,30800,3);
>>SELECT * FROM
+>(DELETE FROM STREAM(invoices)) AS invoices;
CONTRACTNBR AMOUNT PRIORITY
----------- ----------- -----------
100 10500 1
200 20390 2
300 30800 3
*** ERROR[8006]The stream timed out, but the cursor is still open.
---3 row(s) selected.
>>SELECT * FROM invoices;
---0 row(s) selected.
The BEGIN WORK statement enables you to start a transaction explicitly—where the transaction consists of the set of operations defined by the sequence of SQL statements that begins immediately after BEGIN WORK and ends with the next COMMIT WORK or ROLLBACK WORK statement. The BEGIN WORK statement has no effect on nonaudited tables.
the structure is asbelow,
---This statement initiates a transaction.
BEGIN WORK;
--- SQL operation complete.
there are some other SQL operations......
---This statement ends a transaction.
COMMIT WORK;/ ROLLBACK WORK;
--- SQL operation complete.
CONTROL QUERY DEFAULT stream_timeout ‘300‘;
BEGIN WORK;
SELECT * FROM
(DELETE FROM STREAM(invoices)) AS invoices;
CONTRACTNBR AMOUNT PRIORITY
---------------------------------
100105001
200203902
300308003
*** ERROR[8006]The stream timed out,
but the cursor is still open.
ROLLBACK WORK;
SELECT * FROM invoices;
CONTRACTNBR AMOUNT PRIORITY
---------------------------------
100105001
200203902
300308003
---3 row(s) selected.
the differences between "delete form table_name where ......."?
Directlydelete just delete it, cannot get the value in this record and process it.
With the Pub/Sub, we can get this record and then process it and delete it at last.
CREATE TABLE ecui.orders
(order_nbr INT,
amount INT,
status CHAR(1) DEFAULT ‘N‘);
INSERT INTO ORDERS(ORDER_NBR,AMOUNT) VALUES(1,500);
INSERT INTO ORDERS(ORDER_NBR,AMOUNT) VALUES(2,4500);
INSERT INTO ORDERS(ORDER_NBR,AMOUNT) VALUES(3,2100);
>>SELECT * FROM ORDERS;
ORDER_NBR AMOUNT STATUS
-----------
人气教程排行
-
229次
1
oracle 用户解锁和修改用户密码
-
229次
2
解决:安装SQL Server 2008 Native Client遇到错误(在Navicat premium新建sqlserver连接时 需要):An error occurred during ...HRESULT: 0x80070422(注意尾部的错误号)
-
229次
3
rocksdb 编译步骤
-
229次
4
adb命令开关蓝牙及NFC
-
229次
5
解决数据库连接错误 您在wp-config.php文件中提供的数据库用户名和密码可能不正确,或者无法连接到localhost上的数据库服务器,这意味着您的主机数据库服务器已停止工作。
-
229次
6
使用java自动填充,实现mysql的创建修改时间的自动填充
-
229次
7
Linux mount挂载磁盘报错 mount: wrong fs type, bad option, bad superblock on /dev/vdb
-
228次
8
关于mysql创建数据库中字符集和排序规则的选择
-
228次
9
Linux设置Mysql开机自启动服务
-
227次
10
SQL2008:WITH MOVE 子句可用于重新定位一个或多个文件
-
227次
11
图数据库Neo4j在GIS系统的应用
-
227次
12
SpringBoot配置 druid 数据源配置 慢SQL记录
-
227次
13
SQL state [72000]; error code [1013]; ORA-03111: 通信通道收到中断; java.sql.SQLException: ORA-01745: 无效的主机/绑定变量名;java.sql.SQLException: ORA-01013: 用户请求取消当前的操作
-
227次
14
docker-compose启动MySQL并配置远程登录
-
225次
15
Mysql安装(for mac)
-
225次
16
kettle将图片转换至二进制存储至数据库
-
225次
17
adb的安装及配置
-
224次
18
使用PHP控制MODBUS-RTU设备
-
224次
19
MySQL 查询时间差值大于某一个值的 记录
-
224次
20
MongoDB内存配置 --wiredTigerCacheSizeGB