sqlplus

Getting ORA-01861 - Literal does not match format string on SQLPlus Only

試著忘記壹切 提交于 2019-12-11 02:31:49
问题 I have a PL/SQL procedure that takes the following arguments/parameters Procedure create_test(mode_in in number, value1_in in number, value2_in in number, value3_in in varchar2); I am using the following pl/sql block to call and execute the procedure DECLARE lv_mode NUMBER; lv_value1_in NUMBER; lv_value2_in NUMBER; lv_value3 VARCHAR2(3); BEGIN lv_mode := 1; lv_value1_in := 1; lv_value2_in := 1; lv_value3_in := 'ES'; CREATE_TEST( mode_in => lv_mode , value1_in => lv_value1_in, value2_in => lv

Logging output of external program with (wx)python

半城伤御伤魂 提交于 2019-12-11 02:15:07
问题 I'm writing a GUI for using the oracle exp/imp commands and starting sql-scripts through sqlplus. The subprocess class makes it easy to launch the commands, but I need some additional functionality. I want to get rid of the command prompt when using my wxPython GUI, but I still need a way to show the output of the exp/imp commands. I already tried these two methods: command = "exp userid=user/pwd@nsn file=dump.dmp" process = subprocess.Popen(command, stdout=subprocess.PIPE) output = process

Is there an equivalent of less for SQL*Plus?

我只是一个虾纸丫 提交于 2019-12-11 01:15:08
问题 Sometimes a query on SQL*Plus might yield too many rows t fit on the screen. Is there some equivalent of "piping to less/more" mechanism that I can do to navigate the results? select * from emp | less 回答1: SET PAUSE ON see http://www.developer.com/java/data/article.php/3369501/SQLPlus-Tips-for-Oracle-Beginners.htm 回答2: Does SQL*Plus not allow you to run its commands from the shell? It's been a while since I used it but I though it did. I know with DB2 you can just do: db2 'select * from

SQL*Plus : Force it to return an error code

梦想与她 提交于 2019-12-11 00:09:35
问题 I have a stored procedure that has an OUT parameter, indicating an error code. If the error code is not 0, then I raise an error DECLARE BEGIN foo (err_code); IF (err_code <> 0) THEN raise_application_error(...); END; So far so good, but here's my question. This piece of code (shown above) is executed by sqlplus, which is called from a shell script, which should exit with 0 / not 0 (as the sql script). #shell script sqlplus ... @myscript return $? When the raise_application_error executes,

how to change the delimiter in sqlplus in oracle 11g

送分小仙女□ 提交于 2019-12-10 22:11:50
问题 I want to change the delimiter: Can someone help me to change the delimiter in sqlplus in Oracle 11g 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.. 回答1: There is nothing wrong with the syntax of

How to Insert Blob Datatype Values in Oracle 11g Database Through SQL*Plus

我是研究僧i 提交于 2019-12-10 20:14:34
问题 I have created a table with Blob datatype but I do not know how to insert values into the table or view the table content using SQL*Plus. Please help me. 回答1: It depends on what kind of data you want put into a BLOB. Let's consider the table: create table b1(id number , b blob); If your data represented as hex-string you should use TO_BLOB function insert into b1 values(1,to_blob('FF3311121212EE3a')); SQLPLUS also shows BLOBs as hex-string select * from b1; ----- -----------------------------

Creating a simple user interface to access an Oracle database

元气小坏坏 提交于 2019-12-10 19:23:52
问题 Here is what I have: 1) a simple sql file given to me that creates tables and fills them with data 2) a simple sql file that contains PL/SQL procedures I've written for displaying/manipulating the tables The goal is to create some sort of user interface that allows a student to login, view their transcript, withdraw from classes, etc. I am using sqlplus. I have procedures that do all the required displaying/manipulating. I am successful at creating a simple command line UI with sqlplus, but

Creating Package sqlplus

懵懂的女人 提交于 2019-12-10 19:19:56
问题 I am trying to create a package from the following procedure CREATE OR REPLACE PROCEDURE insert_rows (pl_deptno dept.deptno%TYPE, pl_dname dept.dname%TYPE, pl_loc dept.loc%TYPE ) AS BEGIN INSERT INTO dept (deptno,dname,loc) values ( pl_deptno,pl_dname,pl_loc); commit; end insert_rows; / So far this is my package sec which, creates fine create or replace package fpf is procedure insert_rows (p_deptno IN dept.deptno%TYPE, p_dname IN dept.dname%TYPE, p_loc IN dept.loc%TYPE); end fpf; / But, when

sqlplus - using a bind variable in “IN” clause

谁都会走 提交于 2019-12-10 19:05:42
问题 I am setting a bind variable in a PL/SQL block, and I'm trying to use it in another query's IN expression. Something like this: variable x varchar2(255) declare x varchar2(100); begin for r in (select id from other_table where abc in ('&val1','&val2','&val3') ) loop x := x||''''||r.id||''','; end loop; --get rid of the trailing ',' x:= substr(x,1,length(x)-1); select x into :bind_var from dual; end; / print :bind_var; select * from some_table where id in (:bind_var); And I get an error (ORA

Oracle 11 - sqlplus - rollback the whole script on error - how?

喜你入骨 提交于 2019-12-10 17:16:22
问题 How can I make Oracle 11g rollback the whole transaction on any error in included SQL file? The file contents are: set autocommit off whenever SQLERROR EXIT ROLLBACK insert into a values (1); insert into a values (2); drop index PK_NOT_EXIST; commit; And the file is included into sqlplus session using "@": @error.sql As expected, the sqlplus session terminates and the output is SQL> @error.sql 1 row created. 1 row created. drop index PK_NOT_EXIST * ERROR at line 1: ORA-01418: specified index