SQL*PLUS - remove output 'PL/SQL procedure successfully completed.'
Hi,
When I use SQL*PLUS to call a PLSQL procedure, it will always output text: 'PL/SQL procedure successfully completed.' when the PLSQL procedure completes.
I have a requirement to not display this message output. In SQL*PLUS how do you turn this off?
how to disable procedure successfully completed message in SQL*Plus
Similar Messages
-
Commit after PL/SQL procedure successfully completed?
Hello. I have a question, it may be stupid but here goes:
When I run a script like this do I have to commit after it is completed?
SQL> @merge_candidates_INC933736.sql
PL/SQL procedure successfully completed.XerXi wrote:
Hello. I have a question, it may be stupid but here goes:
When I run a script like this do I have to commit after it is completed?
SQL> @merge_candidates_INC933736.sql
PL/SQL procedure successfully completed.
How would anyone know? You didn't post what the script does.
If the script contains nothing but DDL to create objects then you do NOT need to add a COMMIT since Oracle wil implictily commit DDL statements.
A COMMIT should be performed at the END of a transaction. Since we don't know what, if any DML is contained in your script we have no idea how many transactions might be represented.
So for scripts that contain DML you should add a COMMIT to the script after each transaction has been completed. -
Input with sql*plus and Output it with PL/SQL
Hi everyone,
I try to understand how can I get input and input by using sqlplus and plsql together. I get output like this:
Get User Input
Given Name: Iron
Family Name: Man
old 6: Given_Name := '&GivenName';
new 6: Given_Name := 'Iron';
old 7: Family_Name := '&FamilyName';
new 7: Family_Name := 'Man';
Given Name: Iron
Family Name: Man
PL/SQL procedure successfully completed.My Codes:
PROMPT Get User Input
ACCEPT GivenName PROMPT "Given Name: "
ACCEPT FamilyName PROMPT "Family Name: "
DECLARE
Family_Name Varchar(15);
Given_Name Varchar(15);
BEGIN
Given_Name := '&GivenName';
Family_Name := '&FamilyName';
DBMS_OUTPUT.PUT_LINE('Given Name: ' || Given_Name);
DBMS_OUTPUT.PUT_LINE('Family Name: ' || Family_Name);
END;
/My question is why I get
old 6: Given_Name := '&GivenName';
new 6: Given_Name := 'Iron';
old 7: Family_Name := '&FamilyName';
new 7: Family_Name := 'Man';this bit?Is there something wrong in my code? Thanks.Hi,
From SQL*Plus reference:
After you enter a value at the prompt, SQL*Plus lists the line containing the substitution variable twice: once before substituting the value you enter and once after substitution. You can suppress this listing by setting the SET command variable VERIFY to OFF.
So. you can remove current output with
SET VERIFY OFF
and enable your PL/SQL output by
SET SERVEROUTPUT ON
Regards
Peter -
How to download output from a PL/SQL Procedure
Hi all
I have set up a PL/SQL procedure that sets up the mime type etc.
to download the output but IE keeps telling me it can't get the
file. I think that it's something to do with the browser wanting
to just GET the file and getting extra stuff because the mime
header is being sent every time. Anyone managed to do this?
Code sample follows:
create or replace procedure x
is
begin
owa_util.mime_header('application/force-download',false,null);
htp.p('Content-Disposition: attachment;
filename="timeline.html"');
htp.p('Pragma: no-cache');
htp.p('Cache-Control: no-cache');
htp.p('Expires: Thu, 01 Jan 1970 12:00:00 GMT');
owa_util.http_header_close;
htp.p('<HTML>');
htp.p('<body>');
htp.p('Hello there man');
htp.p('</body>');
htp.p('</HTML>');
end;What version are you on?
Works fine for me on my 11g:
SQL> create or replace procedure testxml (clob_out out clob)
2 is
3 l_clob clob;
4 l_ctx dbms_xmlquery.ctxhandle;
5 begin
6 l_ctx := dbms_xmlquery.newcontext ('select * from dual');
7 l_clob := dbms_xmlquery.getxml (l_ctx);
8 clob_out := l_clob;
9 dbms_xmlquery.closecontext (l_ctx);
10 end testxml;
11 /
Procedure created.
SQL>
SQL> variable vout clob;
SQL>
SQL> exec testxml (:vout)
PL/SQL procedure successfully completed.
SQL>
SQL> print vout
VOUT
<?xml version = '1.0'?>
<ROWSET>
<ROW num="1">
<DUMMY>X</DUMMY>
</ROW>
</ROWSET>But definitely you can optimize your proc a bit: Try
create or replace procedure testxml (clob_out in out nocopy clob)
is
l_ctx dbms_xmlquery.ctxhandle;
begin
l_ctx := dbms_xmlquery.newcontext ('select * from dual');
clob_out := dbms_xmlquery.getxml (l_ctx);
dbms_xmlquery.closecontext (l_ctx);
end testxml;
/ -
Suppressing "PL/SQL procedure completed successfully" message?
I use anonymous blocks in some of my SQL*Plus scripts, to do things SQL*Plus can't handle.
However, I'd like to suppress the "PL/SQL procedure completed successfully" message at the end. I've tried several SET values, but without success.
Can anyone tell me what I'm missing? Thanks.set feedback off
SQL> set echo off
SQL> exec test2
PL/SQL procedure successfully completed.
SQL> set feedback off
SQL> exec test2
SQL>
SQL> -
PL/SQL Procedure Calling Java Host Command Problem
This is my first post to this forum so I hope I have chosen the correct one for my problem. I have copied a java procedure to call Unix OS commands from within a PL/SQL procedure. This java works well for some OS commands (Eg ls -la) however it fails when I call others (eg env). Can anyone please give me some help or pointers?
The java is owned by sys and it looks like this
CREATE OR REPLACE AND COMPILE JAVA SOURCE NAMED "ExecCmd" AS
//ExecCmd.java
import java.io.*;
import java.util.*;
//import java.util.ArrayList;
public class ExecCmd {
static public String[] runCommand(String cmd)
throws IOException {
// set up list to capture command output lines
ArrayList list = new ArrayList();
// start command running
System.out.println("OS Command is: "+cmd);
Process proc = Runtime.getRuntime().exec(cmd);
// get command's output stream and
// put a buffered reader input stream on it
InputStream istr = proc.getInputStream();
BufferedReader br = new BufferedReader(new InputStreamReader(istr));
// read output lines from command
String str;
while ((str = br.readLine()) != null)
list.add(str);
// wait for command to terminate
try {
proc.waitFor();
catch (InterruptedException e) {
System.err.println("process was interrupted");
// check its exit value
if (proc.exitValue() != 0)
System.err.println("exit value was non-zero: "+proc.exitValue());
// close stream
br.close();
// return list of strings to caller
return (String[])list.toArray(new String[0]);
public static void main(String args[]) throws IOException {
try {
// run a command
String outlist[] = runCommand(args[0]);
for (int i = 0; i < outlist.length; i++)
System.out.println(outlist);
catch (IOException e) {
System.err.println(e);
The PL/SQL looks like so:
CREATE or REPLACE PROCEDURE RunExecCmd(Command IN STRING) AS
LANGUAGE JAVA NAME 'ExecCmd.main(java.lang.String[])';
I have granted the following permissions to a user who wishes to run the code:
drop public synonym RunExecCmd
create public synonym RunExecCmd for RunExecCmd
grant execute on RunExecCmd to FRED
grant javasyspriv to FRED;
Execute dbms_java.grant_permission('FRED','java.io.FilePermission','/bin/env','execute');
commit
Execute dbms_java.grant_permission('FRED','java.io.FilePermission','/opt/oracle/live/9.0.1/dbs/*','read, write, execute');
commit
The following test harness has been used:
Set Serverout On size 1000000;
call dbms_java.set_output(1000000);
execute RunExecCmd('/bin/ls -la');
execute RunExecCmd('/bin/env');
The output is as follows:
SQL> Set Serverout On size 1000000;
SQL> call dbms_java.set_output(1000000);
Call completed.
SQL> execute RunExecCmd('/bin/ls -la');
OS Command is: /bin/ls -la
total 16522
drwxrwxr-x 2 ora9sys dba 1024 Oct 18 09:46 .
drwxrwxr-x 53 ora9sys dba 1024 Aug 13 09:09 ..
-rw-r--r-- 1 ora9sys dba 40 Sep 3 11:35 afiedt.buf
-rw-r--r-- 1 ora9sys dba 51 Sep 3 09:52 bern1.sql
PL/SQL procedure successfully completed.
SQL> execute RunExecCmd('/bin/env');
OS Command is: /bin/env
exit value was non-zero: 127
PL/SQL procedure successfully completed.
Both commands do work when called from the OS command line.
Any help or assistance would be really appreciated.
Regards,
Bernard.Kamal,
Thanks for that. I have tried to use getErrorStream and it does give me more info. It appears that some of the commands cannot be found. I suspected that this was the case but I am not sure about how this can be as they all appear to reside in the same directory with the same permissions.
What is more confusing is output like so:
SQL> Set Serverout On size 1000000;
SQL> call dbms_java.set_output(1000000);
Call completed.
SQL> execute RunExecCmd('/usr/bin/id');
OS Command is: /usr/bin/id
exit value was non-zero: 1
id: invalid user name: ""
PL/SQL procedure successfully completed.
SQL> execute RunExecCmd('/usr/bin/which id');
OS Command is: /usr/bin/which id
/usr/bin/id
PL/SQL procedure successfully completed.
Regards,
Bernard -
How to pass values to select clause in PL/SQL procedure
Am relatively new to PL/SQL programming and ran into the following issue...
Table
EMP_MASTER
ID VARCHAR2(10);
FIRSTNAME VARCHAR2(20);
DATA FOR EMP_MASTER
'1','SCOTT'
'2','TIGER'
I ran the following SQL Query
SELECT COUNT(*) FROM EMP_MASTER WHERE FIRSTNAME IN ('SCOTT','TIGER');
This select Query is working fine and we get the count = 2 as
expected. Now I want a procedure for the same fn()
CREATE OR REPLACE PROCEDURE TEST_EMP_MASTER(NAMELIST IN VARCHAR2)
IS
CNT NUMBER := 0;
BEGIN
SELECT COUNT(*) INTO CNT FROM EMP_MASTER WHERE FIRSTNAME IN (NAMELIST);
DBMS_OUTPUT.PUT_LINE('Output-->NAMELIST:'||NAMELIST||':cnt:'||cnt);
END;
Now when I test the procedure by passing just one value its working
fine. But when I want to pass multiple values, it doesnt work!
set serveroutput on;
i.e exec TEST_EMP_MASTER('SCOTT'); Works and the output is
Output--->NAMELIST:SCOTT:cnt:1
but don't get the expected output for exec TEST_EMP_MASTER('SCOTT,TIGER');
I understand that the IN modifier in the WHERE clause expects the
values as 'Value1','value2'....I tried different combination by the
passing the values with quotes '''value1'',''value2'''.....but no
successSelect e.*
From EMP_MASTER e;
ID FIRSTNAME
1 1 SCOTT
2 2 TIGER
3 3 CAT
4 4 MOUSE
SQL> create or replace procedure count_emp_master (p_namelist VARCHAR2)
2 AS
3 v_namelist VARCHAR2 (1000) := p_namelist;
4 v_name Varchar2(100);
5 v_count Number := 0;
6 p_count_emp Number := 0;
7 BEGIN
8 v_namelist := ',' || v_namelist || ',';
9
10 FOR cur IN 1 .. LENGTH (v_namelist) - LENGTH (REPLACE (v_namelist, ',', '')) - 1
11 LOOP
12 v_name := (SUBSTR (v_namelist,
13 INSTR (v_namelist, ',', 1, cur) + 1,
14 INSTR (v_namelist, ',', 1, cur + 1)
15 - INSTR (v_namelist, ',', 1, cur) - 1
16 ));
17 Select Count(1)
18 Into v_count
19 From emp_master
20 Where FIRSTNAME = v_name;
21
22 p_count_emp := p_count_emp + v_count;;
23
24 END LOOP;
25
26 dbms_output.put_line ('namelist --> '||p_namelist ||'p_count_emp -->'||p_count_emp);
27 END count_emp_master;
28 /
Procedure created
SQL> exec count_EMP_MASTER('SCOTT');
namelist --> SCOTTp_count_emp -->1
PL/SQL procedure successfully completed
SQL> exec count_EMP_MASTER('SCOTT,TIGER');
namelist --> SCOTT,TIGERp_count_emp -->2
PL/SQL procedure successfully completed
SQL> exec count_EMP_MASTER('SCOTT,TIGER,CAT');
namelist --> SCOTT,TIGER,CATp_count_emp -->3
PL/SQL procedure successfully completed
SQL> exec count_EMP_MASTER('SCOTT,TIGER,CAT,MOUSE');
namelist --> SCOTT,TIGER,CAT,MOUSEp_count_emp -->4
PL/SQL procedure successfully completed
SQL> Message was edited by:
Nicloei W -
Insertin Data useing SQL Procedure Getting Error ORA-00942 and ORA-06512
I have two Schemas ISYS and ISYSTWO
I had created a Stored Procedure RECINC2 in Schema ISYS
as
procedure recinc2(cName IN CHAR,cWhere IN CHAR,cTable in CHAR)
AS
cQry VARCHAR2(1000);
BEGIN
cQry := 'INSERT INTO '||cName||'.'||cTable||' SELECT * FROM '||cTable|| ' WHERE ||cWhere;
dbms_output.put_line(cqry);
EXECUTE IMMEDIATE cQry;
end;
NOW WHEN in Run it gives error
SQL> begin
2 recinc2('ISYSTWO','CODE=4','AGENTS');
3 end;
4 /
INSERT INTO ISYSTWO.AGENTS SELECT * FROM AGENTS WHERE CODE=4
begin
ERROR at line 1:
ORA-00942: table or view does not exist
ORA-06512: at "ISYS.RECINC2", line 8
ORA-06512: at line 2
BUT IF I EXECUTE
the DBMS output
INSERT INTO ISYSTWO.AGENTS SELECT * FROM AGENTS WHERE CODE=4
it executes and gives fine result
Please help
Thanks
Chaand kackriaSQL> conn ISYSTWO/ISYSTWO
Connected.
SQL> grant all on agents to isys;
Grant succeeded.
SQL> conn isys/isys
Connected.
SQL> exec recinc2('ISYSTWO','CODE=4','AGENTS');
INSERT INTO ISYSTWO.AGENTS SELECT * FROM AGENTS WHERE CODE=4
PL/SQL procedure successfully completed. -
Creating a CSV file from a pl/sql procedure
Hi Everyone,
I would like to know how to write a procedure in pl/sql where i need to check if they are any records in a table say "Table A".
If they are any records in the "Table A" then we need to write those records in the "Table A" to the CSV file.
If they are no records then we need to insert a record into the CSV file that "No records are found in "Table A".
Could anybody please help ?
Thanks in advancesee this
ops$tkyte@8i> create or replace procedure dump_table_to_csv( p_tname in varchar2,
2 p_dir in varchar2,
3 p_filename in varchar2 )
4 is
5 l_output utl_file.file_type;
6 l_theCursor integer default dbms_sql.open_cursor;
7 l_columnValue varchar2(4000);
8 l_status integer;
9 l_query varchar2(1000)
10 default 'select * from ' || p_tname;
11 l_colCnt number := 0;
12 l_separator varchar2(1);
13 l_descTbl dbms_sql.desc_tab;
14 begin
15 l_output := utl_file.fopen( p_dir, p_filename, 'w' );
16 execute immediate 'alter session set nls_date_format=''dd-mon-yyyy hh24:mi:ss''
17
18 dbms_sql.parse( l_theCursor, l_query, dbms_sql.native );
19 dbms_sql.describe_columns( l_theCursor, l_colCnt, l_descTbl );
20
21 for i in 1 .. l_colCnt loop
22 utl_file.put( l_output, l_separator || '"' || l_descTbl(i).col_name || '"'
23 dbms_sql.define_column( l_theCursor, i, l_columnValue, 4000 );
24 l_separator := ',';
25 end loop;
26 utl_file.new_line( l_output );
27
28 l_status := dbms_sql.execute(l_theCursor);
29
30 while ( dbms_sql.fetch_rows(l_theCursor) > 0 ) loop
31 l_separator := '';
32 for i in 1 .. l_colCnt loop
33 dbms_sql.column_value( l_theCursor, i, l_columnValue );
34 utl_file.put( l_output, l_separator || l_columnValue );
35 l_separator := ',';
36 end loop;
37 utl_file.new_line( l_output );
38 end loop;
39 dbms_sql.close_cursor(l_theCursor);
40 utl_file.fclose( l_output );
41
42 execute immediate 'alter session set nls_date_format=''dd-MON-yy'' ';
43 exception
44 when others then
45 execute immediate 'alter session set nls_date_format=''dd-MON-yy'' ';
46 raise;
47 end;
48 /
Procedure created.
ops$tkyte@8i> exec dump_table_to_csv( 'emp', '/tmp', 'tkyte.emp' );
PL/SQL procedure successfully completed. -
Passing Queries to PL/SQL procedures
Hi,
Is there any way in PL/SQL procedure that i can pass two Queries Texts as parameters and return the result set by taking MINUS of the rwo Query results.
Thanx in Advace
ShafiqHere is the principle...
SQL> conn scott/tiger
Connected.
SQL> CREATE OR REPLACE FUNCTION qry_minus
2 (p1 IN VARCHAR2, p2 IN VARCHAR2)
3 RETURN sys_refcursor
4 IS
5 return_value sys_refcursor;
6 BEGIN
7 OPEN return_value FOR p1||' MINUS '||p2;
8 RETURN return_value;
9 END;
10 /
Function created.
SQL> VAR q refcursor
SQL> exec :q := qry_minus('SELECT deptno FROM dept', 'SELECT deptno FROM emp')
PL/SQL procedure successfully completed.
SQL> print q
DEPTNO
40
SQL> Obviously because the query is text strings the calling program is responsible for ensuring the validity of the two queries (matching number and datatype of selected columns, etc).
Cheers, APC -
How to make pl/sql procedure not auto-commit?
I wish to be able to execute a create statement, and then rollback if there is a problem with any sql that follows. It seems that you cannot rollback? Why is this?
(My problem is that I wish to execute a series of sql statements and run a rollback if anything before it fails, including the creation of the table)
set serveroutput on;
declare
rcount INTEGER;
PRAGMA AUTONOMOUS_TRANSACTION;
begin
execute immediate 'create table bsdconv_s1stc_code (id number)';
dbms_output.put_line('Table created successfully');
rollback;
exception
when others then dbms_output.put_line('Error while creating table. Probably already exists.');
end;Ni hao, Dong Yage!
I think using procedure and handling on call you might be able to do it.
SQL> create table test (i int);
Table created.
SQL> insert into test values (1);
1 row created.
SQL> select * from test;
I
1
SQL> set serveroutput on;
SQL> declare
2 rcount INTEGER;
3 PRAGMA AUTONOMOUS_TRANSACTION;
4 begin
5 execute immediate 'create table bsdconv_s1stc_code (id number)';
6 dbms_output.put_line('Table created successfully');
7 -- rollback;
8 exception
9 when others then
10 dbms_output.put_line('Error while creating table. Probably already exists.');
11 rollback;
12 end;
13 /
Table created successfully
PL/SQL procedure successfully completed.
SQL> desc bsdconv_s1stc_code
Name Null? Type
ID NUMBER
SQL> select * from test;
I
1
SQL> insert into test values (2);
1 row created.
SQL> set serveroutput on;
SQL> declare
2 rcount INTEGER;
3 PRAGMA AUTONOMOUS_TRANSACTION;
4 begin
5 execute immediate 'create table bsdconv_s1stc_code (id number)';
6 dbms_output.put_line('Table created successfully');
7 -- rollback;
8 exception
9 when others then
10 dbms_output.put_line('Error while creating table. Probably already exists.');
11 rollback;
12 execute immediate 'drop table bsdconv_s1stc_code';
13 end;
14 /
Error while creating table. Probably already exists.
PL/SQL procedure successfully completed.
SQL> select * from test;
I
1
2
SQL> rollback;
Rollback complete.
SQL> select * from test;
no rows selected
SQL> desc bsdconv_s1stc_code;
ERROR:
ORA-04043: object bsdconv_s1stc_code does not exist
On executing PL/SQL block secondly,
it raises exception, displays error messages and drops table
but main transaction is not rolled back.
This is because rollback belongs to only inseide of
AUTONOMOUS_TRANSACTION PL/SQL block.
Now, let us try using procedure.
SQL> grant create table to ushi;
SQL> create or replace
2 procedure create_table
3 is
4 PRAGMA AUTONOMOUS_TRANSACTION;
5 begin
6 execute immediate 'create table bsdconv_s1stc_code (id number)';
7 dbms_output.put_line('Table created successfully');
8 exception
9 when others then
10 dbms_output.put_line('Error while creating table. Probably already exists.');
11 execute immediate 'drop table bsdconv_s1stc_code';
12 raise;
13 end;
14 /
Procedure created.
SQL> select * from test;
no rows selected
SQL> begin
2 insert into test values (1);
3 create_table;
4 exception
5 when others then
6 dbms_output.put_line('Error on Creating table or Transaction');
7 rollback;
8 end;
9 /
Table created successfully
PL/SQL procedure successfully completed.
SQL> select * from test;
I
1
SQL> commit;
Commit complete.
SQL> desc bsdconv_s1stc_code
Name Null? Type
ID NUMBER
SQL> begin
2 insert into test values (2);
3 create_table;
4 exception
5 when others then
6 dbms_output.put_line('Error on Creating table or Transaction');
7 rollback;
8 end;
9 /
Error while creating table. Probably already exists.
Error on Creating table or Transaction
PL/SQL procedure successfully completed.
SQL> select * from test;
I
1
SQL> desc bsdconv_s1stc_code
ERROR:
ORA-04043: object bsdconv_s1stc_code does not exist -
IN operator is not working correctly while calling,although pl/sql procedur
CREATE or REPLACE PROCEDURE TEST(
idListCommaSeparated IN VARCHAR2
AS
CURSOR c_emp IS SELECT first_name,last_name,start_date From Employee where id IN(idListCommaSeparated);
r_emp c_emp%ROWTYPE;
begin
insert into temp1 values('B',sysdate,sysdate,'A');
open c_emp;
loop
fetch c_emp into r_emp;
exit when c_emp%NOTFOUND;
insert into temp1 values(r_emp.first_name,sysdate,sysdate,'A');
--business Logic
end loop;
close c_emp;
end;
/idListCommaSeparated contains values like (2,3,4). while executing this procedure on sqlplus it is succefully created.
When i run the query separately on sqlplus
SELECT first_name,last_name,start_date From Employee where id IN(2,3,4)I got some rows in result.
why i am not getting via procedure correct result.
and one more thing the number of elements in 'idListCommaSeparated' values are not fixed,sometimes it may be(2,3,4) or sometimes variable value may (2,3,5,6).
I am not able to understand,where i am going wrong?see whether you find nested table parameter implantation option useful. Also supported by .net/java in case that's your calling appln.
Below is plsql block having a procedure with input paramater of empid's. It returns a cursor( empno and ename) as out parameter.
The empid's are hardcoded in the calling block.
SQL> create type t_id is table of number
2 /
Type created.
SQL> set serveroutput on
SQL> declare
2
3 v_tid t_id;
4 v_results sys_refcursor;
5
6 v_employee_id number;
7 v_name varchar2(100);
8
9 procedure TEST (p_tid in t_id, p_empcursor out sys_refcursor) as
10 begin
11 open p_empcursor for
12 select empno, ename from scott.emp
13 where empno in (select column_value from table (p_tid));
14
15 end;
16
17
18 begin
19 v_tid := t_id(7902,7934);
20
21 TEST(v_tid,v_results);
22
23 IF v_results IS NOT NULL
24 THEN
25 LOOP
26 FETCH v_results
27 INTO v_employee_id, v_name;
28
29 EXIT WHEN (v_results%NOTFOUND);
30 dbms_output.put_line(v_name);
31 END LOOP;
32
33 IF v_results%ISOPEN
34 THEN
35 CLOSE v_results;
36 END IF;
37 END IF;
38
39 end;
40 /
*FORD*
*MILLER*
PL/SQL procedure successfully completed.
SQL> -
List of values to PL/SQL procedure
I want to execute a query of the form
UPDATE myTable
SET myField = someValue
WHERE myTablePK IN (1, 3, 5, 7, 9)
Through HTML, I have a form field that is a comma-delimited list of values. I want to be able to pass this to a stored proc. What I'm not understanding is how to pass a list of values.
In other words, the form should be:
UPDATE myTable
SET myField = someValue
WHERE myTablePK IN (someList)
What data type should "someList" be? How do I pass it? The number of values in the list is variable and cannot be determined at design-time.Here is an example how to pass a list of values as an input to a stored procedure using dynamiv SQL:
TAPAS>create or replace procedure create_my_view( dept_list IN VARCHAR2)
2 authid CURRENT_USER
3 AS
4 sql_stmt VARCHAR2(1000);
5 begin
6 sql_stmt := 'create or replace view my_view as select deptno from emp where deptno in ('| | dept_list| |')';
7 execute immediate sql_stmt;
8 exception
9 when others then
10 dbms_output.put_line(SQLERRM);
11 end;
12 /
Procedure created.
TAPAS>exec create_my_view('10,20');
PL/SQL procedure successfully completed.
TAPAS>select * from my_view;
DEPTNO
10
10
10
10
10
20
20
20
20
20
20
20
20
20
14 rows selected. -
Pl/sql Procedure is Not Creating With the CLOB data Type
Hi,
I am Using Oracle 10g Express Edition Release2.... My Doubt is While creating a table With CLOB Data Type the table is created successfully,but while Creating a Procedure With the CLOB Data type i am getting an Error Message
2667/5 PL/SQL: Statement ignored
2667/24 PLS-00382: expression is of wrong type
then i tried With the Varchar2(30000) the Procedure is Created Successfully note i have not changed any thing in my code except the data type.
I am Just Confused ......Why the Procedure is not Created with CLOB Data type?
Please advice ...
Thank U
SHANhi,
Thanks for reply....Another Example
CREATE TABLE USER_MAS (USER_ID VARCHAR2 (20 Byte),MAIL_ID VARCHAR2 (255 Byte));
set serveroutput on
declare
atable varchar2(64) := 'USER_MAS';
acolumn varchar2(64) := 'MAIL_ID';
avalue varchar2(64) := 'NEWYORK' ;
dyn_sql clob;
begin
dyn_sql := 'update '||atable||' set '||acolumn||' = '''||avalue|| '''' ;
dbms_output.put_line(dyn_sql);
execute immediate dyn_sql;
end;
commit ;
Error at line 2
ORA-06550: line 9, column 23:
PLS-00382: expression is of wrong type
ORA-06550: line 9, column 5:
PL/SQL: Statement ignored
When i Changed the Data type to varchar2(64)
update USER_MAS set MAIL_ID = 'NEWYORK'
PL/SQL procedure successfully completed.
Commit complete.
I like to Know the Reason Why the Procedure is Not Created in Oracle 10g XE DB
Note :the Same Script i used in 11g DB the Procedure is Created Successfully....
Why you need use CLOB or VARCHAR2 in your temp_num variable as you sending parameters as number?
In the Procedure we are create some run time queries while executing the procedure. There are around 10 run time queries created.
The size of each query is more than 4000 characters . We then add all the queries using union all after each query to the clob variable as the normal varchar will not support.
Please Advice
Thank U
SHAN -
Send Datetime2 value to a SQL Procedure from Java using Hibernate
Hi All,
I Have a Procedure which takes a parameter of type datetime2.
The procedure is called from Java Hibernate.
How can I Pass datetime2 value to SQL procedure from Java?
Thanks in advance,
Shraddha GoreYou may define a global empty array in some package. Then you can do:
SQL> CREATE OR REPLACE PACKAGE pkg
AS
g_empty DBMS_SQL.varchar2_table;
END pkg;
Package created.
SQL> CREATE OR REPLACE PROCEDURE p (
p_tuids IN DBMS_SQL.varchar2_table "DEFAULT pkg.g_empty"
AS
BEGIN
NULL;
END p;
Procedure created.
SQL> BEGIN
p ();
END;
PL/SQL procedure successfully completed.
Maybe you are looking for
-
Steps to integrate ATG with siebel.
What are Steps to integrate ATG with siebel?
-
Access Outlook Shared/Delegated contacts in Word 2010's Quick Access Toolbar (QAT)
Hello Nerds, Is there any way to access Outlook Shared/Delegated contacts in Word 2010's Quick Access Toolbar (QAT). I am able to see shared/delegated contacts in Outlook by clicking "Open Shared Contacts" but Word's 2010 QAT does not have any option
-
[OSB] - Oracle Service Bus 11gR1 ?
Hi everyone! I'm evaluating Oracle Service Bus 10gR3 (10.3.1.0) which I downloaded from http://www.oracle.com/technology/products/integration/service-bus/index.html . Since I've seen that lots Oracle Products are alreadly released as of the platform
-
My photos are blurry on my Iphone 4 why?
-
Http server start/stop process
Hi I always see below start/stop messages in the D:\app\Oracle\opmn\logs\HTTP_Server~1 We are not stopping/starting anything. Does it mean that the http server stop/start itself ? Will this affect users ? 12/06/07 23:18:12 Start process 12/06/26 10:0