oracle 11g如何修改sqlplus中的分隔符
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3005349/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
how to change the delimiter in sqlplus in oracle 11g
提问by Nubkadiya
I want to change the delimiter:
我想更改分隔符:
Can someone help me to change the delimiter in sqlplus in Oracle 11g
有人可以帮我更改 Oracle 11g 中 sqlplus 中的分隔符吗
CREATE OR REPLACE TRIGGER test_trigger
BEFORE INSERT ON test
REFERENCING NEW AS NEW FOR EACH ROW
BEGIN
SELECT test_sequence.nextval INTO :NEW.ID FROM dual;
END;
/
this is the trigger I want to create. but after Select statement it stops because of ; is there. that is why I want to change the delimiter. I hope everyone gets the idea on this now..
这是我要创建的触发器。但是在 Select 语句之后它停止了,因为;在那儿。这就是为什么我想更改分隔符。我希望现在每个人都能对此有所了解..
采纳答案by APC
There is nothing wrong with the syntax of your trigger. I can run it in my (vanilla) SQL*Plus environment:
触发器的语法没有任何问题。我可以在我的(vanilla)SQL*Plus 环境中运行它:
SQL> CREATE OR REPLACE TRIGGER test_trigger
2 BEFORE INSERT ON test
3 REFERENCING NEW AS NEW FOR EACH ROW
4 BEGIN
5 SELECT test_sequence.nextval INTO :NEW.ID FROM dual;
6 END;
7 /
Trigger created.
SQL>
And lo! the trigger works:
还有!触发器工作:
SQL> insert into test (col1) values ('Simples!')
2 /
1 row created.
SQL> select * from test
2 /
ID COL1
---------- ------------
1 Simples!
SQL>
All I can think is that you have some blank lines in the code which you are typing. If this is the situation you can override the default behaviour with this SQL*Plus command:
我所能想到的就是您正在输入的代码中有一些空行。如果是这种情况,您可以使用以下 SQL*Plus 命令覆盖默认行为:
SQL> set sqlblanklines on
回答by Bharat
Is this you are looking for
这是你要找的吗
select q'#Oracle's quote operator#' from dual;
Q'#ORACLE'SQUOTEOPERATO
-----------------------
Oracle's quote operator
Edit 1:
编辑1:
CMDS[EP] {;|c|OFF|ON}
Change or enable command separator - default is a semicolon (;)
回答by BenV
If you're using SQLPlus and not some other tool I'm not sure what the root issue is, but here's the answer to your workaround question:
To change the command delimiter from the default value of ;
use
如果你用sqlplus,而不是其他一些工具,我不知道根本问题是什么,但这里的回答你的问题的解决方法:
从默认值更改命令分隔符;
使用
SQL> set cmdsep /
SQL> show cmdsep
cmdsep "/" (hex 2f)
To restore the default value after you've created your trigger:
要在创建触发器后恢复默认值:
SQL> set cmds off
SQL> show cmds
cmdsep OFF
回答by perfect14
SQL> set sqlt /
to set sql terminator to '/'
将 sql 终止符设置为“/”
SQL> show sqlt
to check current sqlterminator
检查当前的sqlterminator