sqlplus

how to create a trigger in oracle which will restrict insertion and update queries on a table based on a condition

。_饼干妹妹 提交于 2020-01-01 18:44:12
问题 I have account table as this-- create table account ( acct_id int, cust_id int, cust_name varchar(20) ) insert into account values(1,20,'Mark'); insert into account values(2,23,'Tom'); insert into account values(3,24,'Jim'); I want to create a trigger which will ensure that no records can be inserted or update in account table having acct_id as 2 and cust_id as 23. My code is -- create trigger tri_account before insert or update on account for each row begin IF (:new.acct_id == 2 and :new

how to create a trigger in oracle which will restrict insertion and update queries on a table based on a condition

守給你的承諾、 提交于 2020-01-01 18:44:08
问题 I have account table as this-- create table account ( acct_id int, cust_id int, cust_name varchar(20) ) insert into account values(1,20,'Mark'); insert into account values(2,23,'Tom'); insert into account values(3,24,'Jim'); I want to create a trigger which will ensure that no records can be inserted or update in account table having acct_id as 2 and cust_id as 23. My code is -- create trigger tri_account before insert or update on account for each row begin IF (:new.acct_id == 2 and :new

How do I display the full content of LOB column in Oracle SQL*Plus?

别等时光非礼了梦想. 提交于 2019-12-31 13:17:47
问题 When I try to display the contents of a LOB (large object) column in SQL*Plus, it is truncated. How do I display the whole thing? 回答1: SQL> set long 30000 SQL> show long long 30000 回答2: You may also need: SQL> set longchunksize 30000 Otherwise the LOB/CLOB will wrap. 来源: https://stackoverflow.com/questions/122772/how-do-i-display-the-full-content-of-lob-column-in-oracle-sqlplus

How do I display the full content of LOB column in Oracle SQL*Plus?

纵饮孤独 提交于 2019-12-31 13:17:04
问题 When I try to display the contents of a LOB (large object) column in SQL*Plus, it is truncated. How do I display the whole thing? 回答1: SQL> set long 30000 SQL> show long long 30000 回答2: You may also need: SQL> set longchunksize 30000 Otherwise the LOB/CLOB will wrap. 来源: https://stackoverflow.com/questions/122772/how-do-i-display-the-full-content-of-lob-column-in-oracle-sqlplus

How do I Suppress “PL/SQL procedure successfully completed” message in sqlplus?

爷,独闯天下 提交于 2019-12-31 12:57:34
问题 Is there a way that you can have SERVEROUTPUT set to ON in sqlplus but somehow repress the message "PL/SQL procedure successfully completed" that is automatically generated upon completed execution of a plsql procedure? 回答1: Use the command: SET FEEDBACK OFF before running the procedure. And afterwards you can turn it back on again: SET FEEDBACK ON 回答2: This has worked well for me in sqlplus, but I did just notice that "set feedback off" suppresses errors in Sql Developer (at least version 17

How do I Suppress “PL/SQL procedure successfully completed” message in sqlplus?

牧云@^-^@ 提交于 2019-12-31 12:55:12
问题 Is there a way that you can have SERVEROUTPUT set to ON in sqlplus but somehow repress the message "PL/SQL procedure successfully completed" that is automatically generated upon completed execution of a plsql procedure? 回答1: Use the command: SET FEEDBACK OFF before running the procedure. And afterwards you can turn it back on again: SET FEEDBACK ON 回答2: This has worked well for me in sqlplus, but I did just notice that "set feedback off" suppresses errors in Sql Developer (at least version 17

Sqlplus printing the result twice and with an empty line

泄露秘密 提交于 2019-12-31 04:02:26
问题 I write shell script and want to use sqlplus, when I write: #!/bin/bash result=$(sqlplus -s user/pass@DB << EOF set trimspool on; set linesize 32000; SET SPACE 0; SELECT MAX(DNNCMNT_ANSWER_TIME) FROM TKIMEI.DNNCMNT_IMEI_APPRV; / exit; EOF) echo "$result" the result is in txt file (I'm executing it as ksh sql.sh > result.txt ): MAX(DNNCM --------- 10-MAR-14 MAX(DNNCM --------- 10-MAR-14 it is automatically putting an empty line at the beginning of file and writing the result twice. How can I

SQLPlus is trying to drop package twice

大憨熊 提交于 2019-12-31 03:05:15
问题 While executing scripts in SQLPlus I've encountered a problem: script.sql contains the following lines @some_pkg.pks @some_pkg.pkb drop package some_pkg; / After calling > sqlplus user/password@dbname @script.sql the following messages are in console: Package created. Package body created. Package dropped. drop package some_pkg; * ERROR at line 1: ORA-04043: object SOME_PKG does not exist Please, explain what's happening here. Looks like the package is being dropped twice. Is it possible to

Oracle SQLPlus setting environment variable based on variable

柔情痞子 提交于 2019-12-30 22:54:19
问题 I want to set the environment variable long based on the size of the XML data I'm trying to retrieve. The idea is something like this: var XML_DATA_SIZE number; SELECT TRIM(LENGTH(xmltype.getClobVal(xml_data))) INTO :XML_data_size FROM xml_tab WHERE key = '1234'; print XML_DATA_SIZE set long XML_DATA_SIZE set pagesize 0 set line 2000 set termout off spool XMLDATA.xml select xml_data from xml_tab where key = '1234'; spool off This yields an error: SP2-0268: long option not a valid number , and

Oracle SQLPlus setting environment variable based on variable

大憨熊 提交于 2019-12-30 22:53:27
问题 I want to set the environment variable long based on the size of the XML data I'm trying to retrieve. The idea is something like this: var XML_DATA_SIZE number; SELECT TRIM(LENGTH(xmltype.getClobVal(xml_data))) INTO :XML_data_size FROM xml_tab WHERE key = '1234'; print XML_DATA_SIZE set long XML_DATA_SIZE set pagesize 0 set line 2000 set termout off spool XMLDATA.xml select xml_data from xml_tab where key = '1234'; spool off This yields an error: SP2-0268: long option not a valid number , and