Recompiling a Procedure in SQL*Plus
DB Version ; 10gR2
I wanted to recompile a procedure in sqlplus. When i googed it , i found out about dbms_utility.validate from
http://download.oracle.com/docs/cd/B28359_01/server.111/b28310/general007.htm#i1007024
begin
dbms_utility.validate('HR', 'UPDATE_SALARY', namespace=>1);
end;Any idea what namespace means?
This wasn't documented at 10g, even though this was available at 10gR1 as an overloaded procedure:
PROCEDURE VALIDATE
Argument Name Type In/Out Default?
OBJECT_ID NUMBER IN
PROCEDURE VALIDATE
Argument Name Type In/Out Default?
OWNER VARCHAR2 IN
OBJNAME VARCHAR2 IN
NAMESPACE NUMBER IN~ Madrid
Similar Messages
-
How to compile a procedure from Sql*Plus?
Dear friends,
I couldnt find the way how to compile my invalid procedure through sql*Plus.
I know this is very awkward,but I m in need of that command only.
Thanks
Ritesh SharmaPls check it --
SQL>
SQL>
SQL> @C:\RND\Oracle\Function\a.sql;
11 /
Function created.
SQL>
SQL>
SQL> start C:\RND\Oracle\Function\a.sql;
11 /
Function created.
SQL> Regards.
Satyaki De. -
How to execute the parametered stored procedure in sql *plus ?
how to execute the parametered stored procedure in sql *plus ?
my storedprocedure format
CREATE OR REPLACE PROCEDURE SMS_SELECTMPLOYEE
(empDOB out date, empEmpName out varchar2)
thanks & regards
mk_murOh, sorry... making many reading-too-fast mistakes today...
You can't declare date variables in SQL*Plus (seel help var), but you can cast to varchar2:
TEST> CREATE OR REPLACE PROCEDURE SMS_SELECTMPLOYEE (empDOB out date, empEmpName out varchar2) IS
2 d date := sysdate;
3 e varchar2(10) := 'bob';
4 begin
5 empdob := d;
6 empempname := e;
7 end;
8 /
Procedure created.
TEST> var d varchar2(30)
TEST> var n varchar2(30)
TEST> call SMS_SELECTMPLOYEE(:d,:n);
Call completed.
TEST> print d n
D
11/07/06
N
bobYoann. -
How to copy procedure to sql plus window.
I am trying to copy my procedure from note pad to sql plus window and some of the texts are being cut off. How can I copy the entire procedure to sql plus window.
thanksThank you guys this is what is happning.
1 CREATE OR REPLACE PROCEDURE ITEMCUSTOMPAGING(
2 p_desc in itemlist.idescr%type,
3 p_letting in bidlet.datelet%type,
4 p_letting1 in bidlet.datelet%type,
5 p_sort in NUMBER ,
6 p_order in VARCHAR ,
7 i_results out sys_refcursor
8 )
9 AS
10 BEGIN
11 OPEN i_results FOR
12 SELECT g.csecnum , e.iplineno , substr(e.eiitem ,1,4)||'.'||substr(e.eiitem ,5,9) ItemNum,
13 INITCAP(i.idescr ||' '|| e.isupdes) Descrip,INITCAP(i.idescrl ||' '|| e.isupdes) Descrip
14 DECODE (TRIM (p.prroute), NULL, 'N/A',p.prroute) Route,b.datelet ,trim(to_char(b.datelet ,'
15 FROM itemlist i, estitem e, estcatg g, propproj x, proposal p, bidlet b, letprop l
16 WHERE p.contid = x.contid AND x.pcn = g.pcn AND e.pcn = g.pcn AND e.cn = g.cn AND i.item =
17 AND i.ispecyr = p.cspecyr AND e.iplineno <> ' ' AND e.eiitem <> '2550601/01000'
18 AND e.eiitem <> '2565601/00031' AND e.eiitem <> '2565601/00032' AND e.eiitem <> '2565601/0003
19 AND e.eiitem <> '2402601/01000'
20 AND (i.idescr like TRIM(UPPER(p_desc))||'%' or i.idescrl like TRIM( UPPER(p_desc))||'%'
21 AND b.datelet between p_letting and p_letting1
22 AND p.contid = l.lcontid
23 AND l.letting = b.letting
24 AND SUBSTR (l.lcontid, 4, 4) <= '5'
25 GROUP BY g.csecnum,i.idescr,b.datelet,i.iunits,p.clocat1,p.clocat2,p.contid,p.cdescr, p.cproj
26 ORDER BY p_sort p_order;
27* End;
QL> /
arning: Procedure created with compilation errors.
QL> SHOW ERR
rrors for PROCEDURE ITEMCUSTOMPAGING:
INE/COL ERROR
2/8 PL/SQL: SQL Statement ignored
6/25 PL/SQL: ORA-00933: SQL command not properly ended
QL> -
How to view a stored procedure from sql plus
Can anyone please tell what is the command for viewing the content of the stored procedure from sql plus ?
ThanksHi,
I use this simple script to retrieve.......
EDTRAD@T_E_S_9-->l
1 select text from all_source where name = 'GET_MAN' -- proc name here
2* order by line asc
EDTRAD@T_E_S_9-->/
TEXT
FUNCTION get_man (in_man SSBOSS.CLNTWORK.manager%type)
RETURN varchar2 IS
CURSOR get_man(in_man SSBOSS.CLNTWORK.manager%type) IS
SELECT name
FROM ssboss.clntwork
WHERE agency = 'TM'
AND manager = in_man
AND manager is not null
AND manager != '**OB**';
v_man SSBOSS.CLNTWORK.name%type := null;
BEGIN
OPEN get_man(in_man);
FETCH get_man INTO v_man;
IF get_man%notfound THEN
v_man := 'Manager Not Found !';
RETURN (v_man);
CLOSE get_man;
END IF;
RETURN (v_man);
CLOSE get_man;
END;
21 rows selected.
EDTRAD@T_E_S_9--> -
How to pass Unix environment variable to a SQL procedure or SQL * Plus
Can any body suggest me how to ,
How to pass Unix environment variable to a SQL procedure or SQL * Plus file..
I am trying to invoke a SQL Procedure from Unix
by passing the value of a Unix environment variable.
Is it possible..?
Thanks in advance.
Regards,
Srinivas JaltaruWithin your shell script you can use what is known as a "here document" which is basically a way of wrapping a call to Oracle. The following call to Oracle loops and writes rows to files with numerically increasing file names. Two unix shell variables are used, one in a select statement and one in a spool command :
<pre>
#!/bin/bash
export ORACLE_SID=DEV05
FILENO=1007351
while [ ${FILENO} -le 1008400 ]
do
FILENAME=farm_${FILENO}.txt
DUMMY=`sqlplus -s user20/user20 <<SQLSTOP
set lines 73
set pages 0
set head off
set termout off
set echo off
set feedback off
select rpad(searchx, 8)
from blastx@PRODUCTION
where searchx = ${FILENO} ### here's a shell variable
spool /export/home/user20/sql/psiblast/BACKUP2_D/${FILENAME} ### here's a shell variable
spool off
SQLSTOP`
FILENO=`expr ${FILENO} + 1`
done
exit 0
</pre> -
Testing stored procedure using sql plus
I'm attempt to create and test a stored procedure in sql plus.
I enter:
create procedure sp_getconfiguration(mygroup in char, myparameter in char, myvalue in out char) as begin select configvalue into myvalue from tblconfiguration where configgroup = mygroup and configparameter = myparameter; end;/
I get a procedure created. response by when I type:
variable myval char
call sp_getconfiguration('Language','Enabled', myval);
I get the following error:
error at line 1:
ora-06576: not a valid function or procedure name
I can go into DBA studio and see the procedure listed and can compile it and it says "valid". I have tried granting execute permission to public and trying it again under sql plus and nothing seems to help.
I'm also attempting to run this same procedure from VB and get an invalid column name error from there.
Thanks for any help in advance.
LeeThanks for all your help. What I actually called product support and they helped me solve it. But what I found out is that if using oracle 8.1.# you have to invoke the stored procedure without the "call " in front of the procedure name. For instance.
sp_getconfiguation()
In version 9.# it appears that you use the call in front of the procedure. Dah! So if anyone else is having this problem. That is the solution. Thanks anyway. -
How execute this stored procedure from SQL PLUS???
Hello folks....
Help me please...
I have this procedure....
CREATE OR REPLACE PROCEDURE TEST(COD OUT VARCHAR2, NUM OUT
VARCHAR2, ID OUT VARCHAR2)
AS
BEGIN
END;
SO, I4D LIKE TO EXECUTE IT FROM SQL PLUS::
BUT, I DONT KNOW HOW TO DO..PLEASE SEND ME A SAMPLE..
THANK UThank u man!!!
look, my error before was :
SQL> set serveroutput on
SQL> declare
SQL> cod varchar2(100);
SQL> num varchar2(100);
SQL> id varchar2(100);
SQL> begin
SQL> TEST( cod, num, id );
SQL> EXEC DBMS_OUTPUT.put_line( cod || ' ' || num || ' ' ||
id );
SQL> end;
SQL> /
i put the EXEC....
thank u!!! -
Issue with new line when manually executing a procedure in SQL*Plus
The below procedure works fine in SQL*Plus when the entire EXEC <procedure_name> (parameter1, parameter2, ..); is put in a single line
SQL > exec cust_admin_util.create_schema (P_SCHEMA_NAME => 'SCOTT_01', P_SCHEMA_PWD => 'scott123', P_TBS_NAME => 'TRAG_TBS', p_temptbs_name => 'TEMP' );
PL/SQL procedure successfully completed.I wanted to execute the same procedure with more readability. So, I put each parameters on a separate line and try to execute. But it is erroring out.
SQL > exec cust_admin_util.create_schema
P_SCHEMA_NAME => 'TESTUSR_01',
P_SCHEMA_PWD => 'scott123',
P_TBS_NAME => 'TRAG_TBS',
p_temptbs_name => 'TEMP'
);BEGIN cust_admin_util.create_schema; END;
ERROR at line 1:
ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'CREATE_SCHEMA'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
SQL > 2 3 4 5 6 7
P_SCHEMA_NAME => 'TESTUSR_01',
ERROR at line 2:
ORA-00928: missing SELECT keywordAny workaround for this ?Hi Tom,
At SQL Plus,
You have to use the -(Hyphen) as the concatenation Operator.
For Instance,
SQL> exec host_command( -
p_command => 'dir');
PL/SQL procedure successfully completed.
Thanks,
Shankar -
PLS-00201 error occurs when batching a stored procedure in SQL*Plus
I have a batch file to run a stored procedure and spool the results to file. When I enter the commands manually in sql*plus the output works fine and my results are spooled to the output file. But when I run the same commands in the batched script I get an error.
Any ideas?
Stored Procedure:
create or replace procedure MMP( p_cursor in out SYS_REFCURSOR)
as
begin
open p_cursorfor select name, id from table;
end;
batch file 1:
sqlplus -S user/pw@REPORTDV @sp_output_spooled.sql
script file sp_output_spooled.sql
Pasting these commands directly to the SQL*Plus command prompt spools the result set to file as expected.
set colsep '|'
set echo off
set feedback off
set termout off
set heading off
set linesize 9000
set pagesize 0
set trimspool on
set headsep off
spool output.TXT
var rc refcursor
execute MMP(:rc)
print rc
spool off
exit
The errors printed to output.TXT file after the batch is run and error occurs:
BEGIN MMP(:rc); END;
ERROR at line 1:
ORA-06550: line 1, column 8:
PLS-00201: identifier 'MMP' must be declared
ORA-06550: line 1, column 8:
PL/SQL: Statement ignored
ERROR:
ORA-24338: statement handle not executed
SP2-0625: Error printing variable "rc"Hi,
Your code worked fine for me.
Is MMP procedure owned by the same user that is running the batch file or does it have proper privileges and synonym?
vr,
Sudhakar -
Create table as in procedure vs SQL*Plus between 2 utf8-db's
I have a 9.2.05 db with charset UTF8 and Polish characters in it. When I extract a table to another 9.2.05 db with UTF8 charset using create table x as selcect * ...
When I run it in SQL*Plus everything works just fine but when I do the create table as from inside a procedure the national characters are converted to western characters and the length of the record are shorter. Why? How do I get the procedure to work as SQL*Plus does. /GöranThis sounds strange. Could you show the code of the procedure? Could you double-check that your db link points to the right database? Could you add:
SELECT VALUE INTO <variable1>
FROM NLS_DATABASE_PARAMETERS
WHERE PARAMETER='NLS_CHARACTERSET'
SELECT VALUE INTO <variable2>
FROM NLS_DATABASE_PARAMETERS@<dblink>
WHERE PARAMETER='NLS_CHARACTERSET'
to your procedure and output the contents of the PL/SQL <variable1> and <variable2>, e.g. using DBMS_OUTPUT, to verify the character sets of the databases?
-- Sergiusz -
Debugging procedure or packages using sql*plus reg
Dear all,
I am new to oracle, can any body provide me some information related to this below issues.
a) suppose i have created a procedure using sql*plus tool then next day i wanted to debug or modify my stored procedure.
Then what could approach using sql*plus
b) same case if we consider for packages then for any specific stored procedure or functions what would be the approach to debug or modify using sql*plus
yours cordination will be highly appreciate
Thanks n regards
LaxmanUsing SQL*Plus you can debug your stored pl/sql code only adding some "prints" in your code:
SQL> create or replace procedure test is
2 begin
3 dbms_output.put_line('starting...');
4 --do something here
5 dbms_output.put_line('done step 1');
6 --do something else here
7 dbms_output.put_line('end procedure...');
8 end;
9 /
Procedura creata.
SQL> set serverout on
SQL> exec test
starting...
done step 1
end procedure...
Procedura PL/SQL completata correttamente.Or writing logs in a log table:
SQL> create table logtab(ts timestamp(9),mess varchar2(4000));
Tabella creata.
SQL> create or replace procedure test is
2 begin
3 insert into logtab values(systimestamp,'starting...');
4 --do something here
5 insert into logtab values(systimestamp,'done step 1');
6 --do something else here
7 insert into logtab values(systimestamp,'end procedure...');
8 end;
9 /
Procedura creata.
SQL> exec test
Procedura PL/SQL completata correttamente.
SQL> col ts for a40
SQL> col mess for a40
SQL> select * from logtab;
TS MESS
25-DIC-09 15:33:13,656000000 starting...
25-DIC-09 15:33:13,656000000 done step 1
25-DIC-09 15:33:13,656000000 end procedure...Max
[My Italian Oracle blog|http://oracleitalia.wordpress.com] -
I seem to be unable to copy and paste text using the "highlight text and right-click" procedure in Sql*Plus 8.0.6.0.0. The right-mouse button seems to work in everything else so it doesn't seem to be the mouse that is the problem. Does anybody know if this could be due to the way Sql*Plus is set up or some other Oracle related problem?
You can either do SET PAGESIZE 0 which turns off all headings.
Of you can do SET PAGESIZE 50000 which will reprint the headings every 50,000 lines.
50,000 is the max. I don't know of a way to show the headings once, and only once. (you can turn off headings and fake them one time with a select ... from dual before your main query). -
Calling a function from sql*plus
I can call my procedure from sql *plus
by doing
sql>call Proc_name(x,y);
How do you call a function?
nullJohn,
I think moifying the statement
CREATE OR REPLACE PROCEDURE "OGUSER"."OGX1" (user_county in integer, user_permit in integer )
TO
CREATE OR REPLACE FUNCTION "OGUSER"."OGX1" (user_county in integer, user_permit in integer ) return NUMBER is
AND before end you will have to add a return statement
(Probably
return 0;
exception
when others then
return 1;
end;
This will change your procedure to a function but I am not sure you'll be able to see your dbms_output's, if you call the function using select ...
<BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by john saucer ([email protected]):
I want to turn my procedure into a function.
So I can call it with a select statement.
I'm kind of having problems with the return statement at the top and bottom.
I don't quite understand how to declare the type in the return. My procedure calculates 2 pl/sql tables....
My procedure looks like.
CREATE OR REPLACE PROCEDURE "OGUSER"."OGX1" (user_county in integer, user_permit in integer )
as
i integer :=0;
j integer :=0;
type dept_table_type is table of ogxtest%rowtype
index by binary_integer;
type dept2_table_type is table of ogxtest%rowtype
index by binary_integer;
my_dept_table dept_table_type;
my_dept2_table dept2_table_type;
v_cotemp number := user_county;
v_permittemp number := user_permit;
v_origcotemp number := user_county;
v_origpermittemp number := user_permit;
v_count number(2) :=1;
v_count2 number(2) := 1;
v_oldcount number(2) :=1;
v_oldcount2 number(2) := 1;
begin
select count(*) into v_count from ogxtest where oco=v_cotemp and opermit=v_permittemp;
select count(*) into v_oldcount from ogxtest where nco=v_cotemp and npermit=v_permittemp;
while v_count >= 1 LOOP
i := i+1;
v_count2 := v_count2 +1;
select *
into my_dept_table(i)
from ogxtest where oco=v_cotemp and opermit=v_permittemp;
v_cotemp := my_dept_table(i).nco;
v_permittemp := my_dept_table(i).npermit;
select count(*) into v_count from ogxtest where oco=v_cotemp and opermit=v_permittemp;
end loop;
while v_oldcount >= 1 LOOP
j := j+1;
v_oldcount2 := v_oldcount2 +1;
select *
into my_dept2_table(j)
from ogxtest where nco=v_origcotemp and npermit=v_origpermittemp;
v_origcotemp := my_dept2_table(j).oco;
v_origpermittemp := my_dept2_table(j).opermit;
select count(*) into v_oldcount from ogxtest where nco=v_origcotemp and npermit=v_origpermittemp;
end loop;
for i in 1..v_count2-1
loop
dbms_output.put_line(' reassigned to - orig county ' | |my_dept_table(i).oco | | ' orig permit ' | |my_dept_table(i).opermit| | ' new county ' | |
my_dept_table(i).nco | | ' new permit ' | |my_dept_table(i).npermit );
end loop;
for j in 1..v_oldcount2-1
loop
dbms_output.put_line(' reassigned from - orig county ' | |my_dept2_table(j).oco | | ' orig permit ' | |my_dept2_table(j).opermit| | ' new county ' | |
my_dept2_table(j).nco | | ' new permit ' | |my_dept2_table(j).npermit );
end loop;
end;
<HR></BLOCKQUOTE>
null -
Stored Procedure vs SQL Injection
Hello
I am workin in a migration project. In this project we are remaking a web application based in ASP classic to ASP.NET but there is a serious problem: the principal query is suprisingly slow in the ASP.NET application and I don't know why.
I'm using a stored procedure which contains the same query used in ASP classic, but it is slower than the query itself. I'd been doing some test and definitely the use of stored procedure with ASP.NET is slower than de sql injection in ASP classic and this seems very improbable theoretically.
I really need to improve the speed of that stored proceudre but I don't know how, and it is driving me crazy because the query is a simple select.
I'll thank every help/explanation about it.
sorry for my english.I think you may have posted in the wrong section of the forum since this really doesn't sound like this is necessarily an issue with ODP.NET or even anything Windows / .NET-related.
That said, have you tried running the procedure using SQL-Plus? You should also check the explain plan to make sure that you're taking advantage of indexes, etc. although if the query by itself is fast, then there may be a problem with the way the procedure is written. Also, as far as I know it's almost impossible to figure out why a query is slow based on the info you've given thus far. You may want to post some or all of the procedure if you're able to do so without causing problems with your employer. Without any way to recreate the issue, it's hard to say what the problem might be. Again, though....try running the procedure using SQL-Plus directly and see how that works out.
Maybe you are looking for
-
Trackpad and Keyboard intermittent Freezing
My trackpad and keyboard are freezing at random intervals for random spans of time (usually for a few seconds). I havent downloaded any recent software that has cause this to my knowledge. Any help would be wonderful because even typing this is frust
-
I can't use my Visa card!!!!!
All of the information are correct, but I don't know where is the problem ??
-
Dashboard prompt in left on dashbaord
Hi My report having around 20 columns and so for dashboard prompt i need to roll the window in right . is there any way i can see my dashborad prompt in the left so that no need to roll right. Thanks,
-
Microsoft has added a community for Office for Mac at MS Answers
Not entirely related, just a heads up for Office for Mac users: Microsoft Answers now has an official Office for Mac community to ask questions at: http://answers.microsoft.com/en-us/mac
-
Hi guru's I want BW 7 Version material , if any body have that plz send me that material .I will assign full points for that. plz send me to this mail id: [email protected] Regards reddy