📄 currentschema.out
字号:
ij> select * from app.t1;A --------------------------------------------------------------------------------------------------------------------------------APP ij> set current schema app;0 rows inserted/updated/deletedij> -- target listselect current schema from t1;1 --------------------------------------------------------------------------------------------------------------------------------APP ij> -- where clauseselect * from t1 where a = current schema;A --------------------------------------------------------------------------------------------------------------------------------APP ij> -- update statementdelete from t1;1 row inserted/updated/deletedij> insert into t1 values ('test');1 row inserted/updated/deletedij> select * from t1;A --------------------------------------------------------------------------------------------------------------------------------test ij> update t1 set a = current schema;1 row inserted/updated/deletedij> select * from t1;A --------------------------------------------------------------------------------------------------------------------------------APP ij> set schema judy;0 rows inserted/updated/deletedij> update app.t1 set a = current schema;1 row inserted/updated/deletedij> select * from app.t1;A --------------------------------------------------------------------------------------------------------------------------------JUDY ij> set schema app;0 rows inserted/updated/deletedij> drop table t1;0 rows inserted/updated/deletedij> -- defaultset schema APP;0 rows inserted/updated/deletedij> create table t1 ( a int, b varchar(128) default current schema);0 rows inserted/updated/deletedij> insert into t1 (a) values (1);1 row inserted/updated/deletedij> set schema SYS;0 rows inserted/updated/deletedij> insert into app.t1 (a) values (1);1 row inserted/updated/deletedij> set schema judy;0 rows inserted/updated/deletedij> insert into app.t1 (a) values (1);1 row inserted/updated/deletedij> set schema APP;0 rows inserted/updated/deletedij> select * from t1;A |B --------------------------------------------------------------------------------------------------------------------------------------------1 |APP 1 |SYS 1 |JUDY ij> drop table t1;0 rows inserted/updated/deletedij> -- check constraint - this should failcreate table t1 ( a varchar(128), check (a = current schema));ERROR 42Y39: 'CURRENT SCHEMA' may not appear in a CHECK CONSTRAINT definition because it may return non-deterministic results.ij> create table t1 ( a varchar(128), check (a = current sqlid));ERROR 42Y39: 'CURRENT SCHEMA' may not appear in a CHECK CONSTRAINT definition because it may return non-deterministic results.ij> -- try mix casecreate schema "MiXCase";0 rows inserted/updated/deletedij> set schema "MiXCase";0 rows inserted/updated/deletedij> values current schema;1 --------------------------------------------------------------------------------------------------------------------------------MiXCase ij> set schema app;0 rows inserted/updated/deletedij> values current schema;1 --------------------------------------------------------------------------------------------------------------------------------APP ij> set schema 'MiXCase';0 rows inserted/updated/deletedij> values current schema;1 --------------------------------------------------------------------------------------------------------------------------------MiXCase ij> -- following should get error - schema not foundset schema 'MIXCASE';ERROR 42Y07: Schema 'MIXCASE' does not existij> set schema mixcase;ERROR 42Y07: Schema 'MIXCASE' does not existij> -- try long schema names (maximum schema identifier length has been changed to 30 as part of DB2 compatibility work)create schema t23456789012345678901234567890;0 rows inserted/updated/deletedij> values current schema;1 --------------------------------------------------------------------------------------------------------------------------------MiXCase ij> set schema app;0 rows inserted/updated/deletedij> values current schema;1 --------------------------------------------------------------------------------------------------------------------------------APP ij> set schema t23456789012345678901234567890;0 rows inserted/updated/deletedij> values current schema;1 --------------------------------------------------------------------------------------------------------------------------------T23456789012345678901234567890 ij> set schema app;0 rows inserted/updated/deletedij> values current schema;1 --------------------------------------------------------------------------------------------------------------------------------APP ij> set schema 'T23456789012345678901234567890';0 rows inserted/updated/deletedij> values current schema;1 --------------------------------------------------------------------------------------------------------------------------------T23456789012345678901234567890 ij> set schema app;0 rows inserted/updated/deletedij> values current schema;1 --------------------------------------------------------------------------------------------------------------------------------APP ij> autocommit off;ij> prepare p1 as 'set schema ?';ij> execute p1 using 'values(''T23456789012345678901234567890'')';0 rows inserted/updated/deletedij> values current schema;1 --------------------------------------------------------------------------------------------------------------------------------T23456789012345678901234567890 ij> -- the following should fail - 129 lengthcreate schema TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT;ERROR 42622: The name 'TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT' is too long. The maximum length is '128'.ij> set schema TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT;ERROR 42622: The name 'TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT' is too long. The maximum length is '128'.ij> set schema 'TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT';ERROR 42622: The name 'TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT' is too long. The maximum length is '128'.ij> execute p1 using 'values(''TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT'')';ERROR 42815: The replacement value for 'CURRENT SCHEMA' is invalid.ij> rollback;ij> autocommit on;ij> -- clean updrop schema judy restrict;0 rows inserted/updated/deletedij> drop schema TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT restrict;ERROR 42622: The name 'TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT' is too long. The maximum length is '128'.ij>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -