Trigger to execute the procedure
I have a procedure say p1.
I want to create a trigger . the trigger should perform the following
When the procedure throws an exception error , The trigger should execute and call the procedure again
Please help me with code
When the procedure throws an exception error , The trigger should execute and call the procedure againAnd when the procedure fails again, the trigger fires, calls the procedure, which fails again which fires the trigger which calls teh procedure which ... You get the picture.
An EXCEPTION is something that ought not to occur. It is literally exceptional. Consequently if you're procedure throws an exception you need to do something different, to handle it. This is a design decision.
If your exception represents a transient condition then your procedure should not throw an exception. Rather it should handle it internally, maybe by sleeping for a second (or whatever is appropriate) and then trying again.
If your exception represents something from which it is not possible for the failing unit to recover then the exception should be passed up the calling stack until it reaches a point where it can be handled. What this level might be depends on the nature of your application.
Cheers, APC
Similar Messages
-
While executing the Procedure Getting Error
Hi I am New to ODI.
I create one new Procedure just to delete the Target table.
delete from <%=snpRef.getTable("L","T_CUSTOMER","D")%>. T_Customer is my target table.Technology:Oracle(Both Source and Target)
I selected the correct Context ,Schema and Technology.
While executing the procedure i am getting following error
java.lang.Exception: Internal error: object ConnectConnection
ColConnectId:null
ColContextCode:DEV
ColConName:null
ColIndCommit:null
ColIsolLevel:null
ColLschemaName:null
ColPlanComp:null
ColTechIntName:null
DefConnectId:null
DefContextCode:DEV
DefConName:null
DefIndCommit:null
DefIsolLevel:null
DefLschemaName:FCS
DefPlanComp:null
DefTechIntName:ORACLE
ExeChannel:J
IndErr:1
IndLogMethod:null
IndLogNb:null
LogLevDet:3
Nno:1
OrdTrt:0
ScenTaskNo:1
SessNo:61001
TaskName1:Procedure
TaskName2:Delete
TaskName3:Delete
TaskType:S
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execSrcOrders(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTaskTrt(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSqlS.treatTaskTrt(SnpSessTaskSqlS.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java)
at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java)
at com.sunopsis.dwg.cmd.DwgCommandSession.treatCommand(DwgCommandSession.java)
at com.sunopsis.dwg.cmd.DwgCommandBase.execute(DwgCommandBase.java)
at com.sunopsis.dwg.cmd.e.i(e.java)
at com.sunopsis.dwg.cmd.g.y(g.java)
at com.sunopsis.dwg.cmd.e.run(e.java)
at java.lang.Thread.run(Unknown Source)
Thanks in advance.i Used the below syntax and checked its working fine.
delete from <%=snpRef.getObjectName("L","T_CUSTOMER","D")%> -
Database is Hanging after executing the Procedure ...
Dear All i am using 10G.
I Have a procedure . After executing the Procedure when i try to call that procedure it is hanging ...
it is creating Locks .. As our DBA told..And told to check the code ...
Can any one tell me how can i put mu codes with formatting ? When i copy paste my code it is showing properly but after POST MESSAGE it is showing like i have written history ...--*
I am Executing the procedure like this ...
EXEC simulator_validation ('0|BP-V1|20101004|01|1|2430962.89|27|2430962.89|MUR|20100928120106','04-SEP-2010',27,2430962.89,'MUR','000111111111');
And my code is :-
{Create Or Replace Procedure simulator_validation (lstring varchar2,ldate date,lno_item number,ltotal number,lcur varchar2,lac_no Varchar2)
IS
l_swift_code_acno number;
l_ACno_Valid number;
l_swift_code_others Number;
lpcode varchar2(5);
lCcode Varchar2(4);
lval number;
lacno varchar2(16);
v_file varchar2(20);
v_path varchar2(50);
LToken VARCHAR2(100) ;
i PLS_INTEGER := 2 ;
lfirst_char number;
lvalue Varchar2(100) ;
lcol number:= 1;
Begin
lfirst_char := Substr(lstring,0,1);
Dbms_output.put_line(lfirst_char);
IF lfirst_char = '0' Then ------------------- For the 1st Line - Should be start from 0
Loop
LToken := mcb_simulator_pkg.Split( lstring, i , '|') ;
lvalue := LToken;
IF lcol=1 then
If lvalue='BP-V1' THEN
Dbms_output.put_line('1');
Else
Insert into MU_SIMULATOR_output_ERR (load_no,ERR_CODE,ERR_DESC) values (1111,'0003','Invalid file type and version number');
Dbms_output.put_line('2');
End if;
Elsif lcol=2 then
If lvalue=To_Char(ldate,'YYYYMMDD') THEN
Dbms_output.put_line('3');
Else
Insert into MU_SIMULATOR_output_ERR (load_no,ERR_CODE,ERR_DESC) values (1111,'0004','Due date differs from the value inputted in the loading screen');
Dbms_output.put_line('4');
End if;
Elsif lcol=3 then
Begin
Select PAYMENT_PURPOSE_CODE into lpcode
From MU_PURPOSE_CODE
Where PAYMENT_PURPOSE_CODE = lvalue;
IF lpcode = lvalue Then
Dbms_output.put_line('5');
Else
Insert into MU_SIMULATOR_output_ERR (load_no,ERR_CODE,ERR_DESC) values (1111,'0006','Invalid payment purpose code');
Dbms_output.put_line('6');
End If;
Exception
When No_data_found Then
Insert into MU_SIMULATOR_output_ERR (load_no,ERR_CODE,ERR_DESC) values (1111,'0006','Invalid payment purpose code');
End;
Elsif lcol=4 then
If lvalue='1' THEN
Dbms_output.put_line('7');
Else
Insert into MU_SIMULATOR_output_ERR (load_no,ERR_CODE,ERR_DESC) values (1111,'0008','Total number of debit records in header does not tally with number debit records in the file.');
Dbms_output.put_line('8');
End if;
Elsif lcol=5 then
If lvalue=ltotal THEN
Dbms_output.put_line('9');
Else
Insert into MU_SIMULATOR_output_ERR (load_no,ERR_CODE,ERR_DESC) values (1111,'0010','Total debit transaction amount in header does not tally with the sum of debit transaction amount in the file');
Dbms_output.put_line('10');
End if;
Elsif lcol=6 then
If lvalue=lno_item THEN
Dbms_output.put_line('11');
Else
Insert into MU_SIMULATOR_output_ERR (load_no,ERR_CODE,ERR_DESC) values (1111,'0025','Number of credit records does not tally with credit records in the file.');
End if;
Elsif lcol=7 then
If lvalue=ltotal THEN
Dbms_output.put_line('12');
Else
Insert into MU_SIMULATOR_output_ERR (load_no,ERR_CODE,ERR_DESC) values (1111,'0026','Sum of credit records does not tally with total transaction amount as inputted in the loading screen');
End if;
Elsif lcol=8 then
If lvalue=lcur THEN
Begin
Select Cur_CODE into lCcode
From Mu_currency_Code
Where Cur_CODE = lvalue;
Dbms_output.put_line('13');
Exception
When No_data_found Then--------------------
Insert into MU_SIMULATOR_output_ERR (load_no,ERR_CODE,ERR_DESC) values (1111,'0014','Invalid Currency');
End;
Else
Insert into MU_SIMULATOR_output_ERR (load_no,ERR_CODE,ERR_DESC) values (1111,'0013','Currency differs from the value inputted in the loading screen');
End if;
Elsif lcol=9 then
If lvalue=Null THEN
Insert into MU_SIMULATOR_output_ERR (load_no,ERR_CODE,ERR_DESC) values (1111,'0015','Timestamp should not be null');
Elsif lvalue <> lvalue Then
Insert into MU_SIMULATOR_output_ERR (load_no,ERR_CODE,ERR_DESC) values (1111,'0046','Timestamp in header should be in the format YYYYMMDDHHMMSS');
End if;
End IF;
EXIT WHEN LToken IS NULL ;
i := i + 1 ;
lcol:=lcol+1;
End LOOP;
Else
Insert into MU_SIMULATOR_output_ERR (load_no,ERR_CODE,ERR_DESC) values (9999,'0002','First line should always start with 0');
End if ;}
-------------------- For the 2nd Line , should be start from 9 .-----------------------------
{ lfirst_char := Substr(lstring,0,1);
IF lfirst_char = '9' Then
LOOP
LToken := mcb_simulator_pkg.Split( lstring, i , '|') ;
lvalue := LToken;
IF lcol=1 then
If lvalue < 0 THEN
Insert into MU_SIMULATOR_output_ERR (load_no,ERR_CODE,ERR_DESC) values (1111,'0017','Amount should be greater than zero');
Elsif lvalue = ltotal THEN
Dbms_output.put_line('20');
Else
Insert into MU_SIMULATOR_output_ERR (load_no,ERR_CODE,ERR_DESC) values (1111,'0018','Transaction amount differs from the value inputted in the loading screen');
End if;
ELSIF lcol = 2 THEN
If lvalue = Substr(lac_no,4,9) THEN
mcb_simulator_pkg.Acct_no_Validator(lvalue,1111,l_ACno_Valid);
mcb_simulator_pkg.Swift_code_validator_for_ac_no(lvalue,1111,l_swift_code_acno);
Else
Insert into MU_SIMULATOR_output_ERR (load_no,ERR_CODE,ERR_DESC) values (1111,'0020','Account number differs from the account number inputted in the loading screen');
End if;
ELSIF lcol = 3 THEN
If lvalue is not null THEN
mcb_simulator_pkg.Swift_code_validator_for_other(lvalue,1111,l_swift_code_others);
Else
Dbms_output.put_line('21');
End if;
END IF;
EXIT WHEN LToken IS NULL ;
i := i + 1 ;
lcol:=lcol+1;
End Loop;
Else
Insert into MU_SIMULATOR_output_ERR (load_no,ERR_CODE,ERR_DESC) values (8888,'0016','Second line should start with 9');
End IF; }
-------------------- For the 3rd Line Should be start from 1.--------------------------
{ LOOP
lfirst_char := Substr(lstring,0,1);
IF lfirst_char = '1' Then
Loop
LToken := mcb_simulator_pkg.Split( lstring, i , '|') ;
lvalue := LToken;
IF lcol=1 then
If lvalue > 0 THEN
Dbms_output.put_line('24');
Else
Insert into MU_SIMULATOR_output_ERR (load_no,ERR_CODE,ERR_DESC) values (1111,'0017','Amount should be greater than zero'); End if;
ELSIF lcol=2 then
Mcb_simulator_pkg.Acct_no_Validator(lvalue,1111,l_ACno_Valid);
Mcb_simulator_pkg.Swift_code_validator_for_ac_no(lvalue,1111,l_swift_code_acno);
ELSIF lcol = 3 THEN
If lvalue is not null THEN
mcb_simulator_pkg.Swift_code_validator_for_other(lvalue,1111,l_swift_code_others);
Else
Dbms_output.put_line('26');
End
END IF;
EXIT WHEN LToken IS NULL ;
i := i + 1 ;
lcol:=lcol+1;
End Loop;
Else
Insert into MU_SIMULATOR_output_ERR (load_no,ERR_CODE,ERR_DESC) values (7777,'0022','The third line onward should start with 1');
End if;
END LOOP;
Commit;
End;}
Edited by: LuKKa on Oct 4, 2010 9:20 PM
Edited by: LuKKa on Oct 4, 2010 9:25 PMYes i gave {} but it is also coming like this ...Yes, since you should use {noformat}{noformat} before and after your example, and not putting your example between a '{' and a '}'.
So, when you post/type/copypaste:
{noformat}select *
from emp;{noformat}
on this forum, it will appear as:select *
from emp;See the FAQ for more tags/tips:
http://forums.oracle.com/forums/help.jspa -
Strage behaviour while executing the Procedure
Hi All,
In Schema "Dwr_trade" we have one procedure Proc1. There is another schema
" Dwr_trade_user " this schema has execute privilege on Proc1 of "Dwr_trade" schema.
When we are executing the procedure Proc1 from "Dwr_trade" schema as follows
Dwr_trade --- (Procedure is created here)
Begin
Exec procedure Dwr_trade.Proc1
End;
It gives error ,but when we are executing the same procedure after removing the prefix "Dwr_Trade" it is executing successfully.
when we are executing the procedure from "Dwr_trade_user " then also is working fine.We are executing it as follows.
Dwr_trade_user
Begin
Exec procedure Dwr_trade.Proc1
End;
Any pointer why this is giving error in 1st case.
Many Thanks
DikshitBegin
Exec procedure Dwr_trade.Proc1 <----Isnt Syntax prob
End;
SQL> CREATE OR REPLACE PROCEDURE mypro AS
2 BEGIN
3 null;
4 END;
5 .
SQL> /
Procedure created.
SQL> EXECUTE PROCEDURE mypro;
BEGIN PROCEDURE mypro; END;
ERROR at line 1:
ORA-06550: line 1, column 7:
PLS-00103: Encountered the symbol "PROCEDURE" when expecting one of the following:
begin case declare exit for goto if loop mod null pragma
raise return select update while with <an identifier>
<a double-quoted delimited-identifier> <a bind variable> <<
close current delete fetch lock insert open rollback
savepoint set sql execute commit forall merge
<a single-quoted SQL string> pipe
SQL> EXECUTE PROCEDURE scott.mypro;
BEGIN PROCEDURE scott.mypro; END;
ERROR at line 1:
ORA-06550: line 1, column 7:
PLS-00103: Encountered the symbol "PROCEDURE" when expecting one of the following:
begin case declare exit for goto if loop mod null pragma
raise return select update while with <an identifier>
<a double-quoted delimited-identifier> <a bind variable> <<
close current delete fetch lock insert open rollback
savepoint set sql execute commit forall merge
<a single-quoted SQL string> pipe
The symbol "PROCEDURE" was ignored.
SQL> EXECUTE mypro;
PL/SQL procedure successfully completed.
SQL> EXECUTE scott.mypro;
PL/SQL procedure successfully completed.Khurram -
Call or execute the procedure 1000 times simultaneously
Hi all,
I hava written a procedure. And i want to call or execute the procedure 1000 times simultaneously.
I don't want like below
for i in 1..1000 loop
exec procedure1
end loop;
Any Idea ?
Bye
NathanYou want the procedure to run 1000 simultaneously? Well, one way to do this is to set up 1000 SQL*Plus sessions and prepare 1000 EXEC statements, which you kick off at the same time. This approach is good if you're a Hindu deity.
Alternatively you can use DBMS_JOB to submit calls to the procedure, viz.
for i in 1..1000 loop
DBMS_JOB.SUBMIT(jobno , what=>'procedure1', next_date=> trunc(SYSDATE) + 11/24);
end loop; This - trunc(SYSDATE) + 11/24 - ensures that all the jobs kick off at 11 o'clock in the morning. You may need to adjust the timing to suit your needs.
Are you sure you have sufficient resources to run this job 1000 times?
Vibes, APC -
Gettng Error while executing the procedure(oracle 10.2.0.3.0)
Hi all,
I am getting following error While executing the package .
PLS-00103: Encountered the symbol "Truncate" when expecting one of
the following:
* & = - + ; < / > at in is mod remainder not rem return
returning <an exponent (**)> <> or != or ~= >= <= <> and or
like LIKE2_ LIKE4_ LIKEC_ between into using || multiset bulk
member SUBMULTISET_I have written follwing query in the package body.
EXECUTE IMMEDIATE 'TRUNCATE TABLE FORT ';
EXECUTE IMMEDIATE '
INSERT INTO FORT (CID,CODE,DESC,SCODE,SES,T_DT,SDN,LANG)
SELECT
SERVICES.CID CID,
PROFILE.FUCODE CODE,
TO_DATE(SUBSTR(SERVICES.STAT_CHNG,-7,6),'YYMMDD') T_DT,
PHOR.NUM SDN,
C_ALL.cLANGUAGE LANG
FROM
SERVICES .....Please give me the solution for this .
Thank y ou
Edited by: user636482 on Apr 10, 2009 1:08 AMI am getting following errors if I gave " ' " after not null.
LINE/COL ERROR
42/8 PLS-00103: Encountered the symbol "AND" when expecting one of the
following:
begin case declare end exception exit for goto if loop mod
null pragma raise return select update while with
<an identifier> <a double-quoted delimited-identifier>
<a bind variable> << close current delete fetch lock insert
open rollback savepoint set sql execute commit forall merge
pipe
42/56 PLS-00103: Encountered the symbol "A" when expecting one of the
following:
LINE/COL ERROR
) , * & | = - + < / > at in is mod remainder not rem => ..
<an exponent (**)> <> or != or ~= >= <= <> and or like LIKE2_
LIKE4_ LIKEC_ between || multiset member SUBMULTISET_
The symbol ", was inserted before "A" to continue.
42/74 PLS-00103: Encountered the symbol "D" when expecting one of the
following:
* & - + ; / at mod remainder rem return returning
<an exponent (**)> and or || multiset
The symbol "* was inserted before "D" to continue.
LINE/COL ERROR
45/6 PLS-00103: Encountered the symbol "COMMIT"
52/3 PLS-00103: Encountered the symbol "PROCEDURE" when expecting one
of the following:
end not pragma final instantiable order overriding static
member constructor map
The symbol "static" was substituted for "PROCEDURE" to continue.
85/8 PLS-00103: Encountered the symbol "AND" when expecting one of the
following:
begin case declare end exception exit for goto if loop mod
null pragma raise return select update while with
LINE/COL ERROR
<an identifier> <a double-quoted delimited-identifier>
<a bind variable> << close current delete fetch lock insert
open rollback savepoint set sql execute commit forall merge
pipe
85/56 PLS-00103: Encountered the symbol "A" when expecting one of the
following:
) , * & | = - + < / > at in is mod remainder not rem => ..
<an exponent (**)> <> or != or ~= >= <= <> and or like LIKE2_
LIKE4_ LIKEC_ between || multiset member SUBMULTISET_
The symbol ", was inserted before "A" to continue.
LINE/COL ERROR
85/74 PLS-00103: Encountered the symbol "D" when expecting one of the
following:
* & - + ; / at mod remainder rem return returning
<an exponent (**)> and or || multiset
The symbol "* was inserted before "D" to continue.
88/8 PLS-00103: Encountered the symbol "COMMIT"
95/3 PLS-00103: Encountered the symbol "PROCEDURE" when expecting one
of the following:
end not pragma final instantiable order overriding static
LINE/COL ERROR
member constructor map
The symbol "static" was substituted for "PROCEDURE" to continue.
133/3 PLS-00103: Encountered the symbol "PROCEDURE" when expecting one
of the following:
end not pragma final instantiable order overriding static
member constructor map
The symbol "static" was substituted for "PROCEDURE" to continue.
169/3 PLS-00103: Encountered the symbol "PROCEDURE" when expecting one
of the following:with out adding " ' " I am getting the previous error which I mentioned in Previous thread(TRUNCATE)
Thank you -
Error while executing the procedure
Hi,
I tried the following example it's compiled but while executing giving the errors
create or replace PROCEDURE createRZGSet (
rNm IN VARCHAR2,
rDsc IN VARCHAR2,
rId OUT NUMBER
) IS
cId INTEGER;
BEGIN
cId := 1;
SELECT q_id.NEXTVAL
INTO rId
FROM DUAL;
INSERT INTO t_set (rid,
r_nm,
r_dsc,
o_id,
flag) VALUES (rId,rNm,rDsc,cid,'P');
END;
/The above is compiled ... but while executing
SQL> declare
2 optval number;
3 begin
4 execute createRZGSet('myp','miyapur',optval);
5 dbms_output.put_line('val returned is:'||optval);
6 end;
7 /
execute createRZGSet('myp','miyapur',optval);
ERROR at line 4:
ORA-06550: line 4, column 10:
PLS-00103: Encountered the symbol "CREATERZGSet" when expecting one
of the following:
:= . ( @ % ; immediate
The symbol ":=" was substituted for "CREATERZGSet" to continue.could you please hint me in this error..
thanxThe above is compiled ... but while executing
SQL> declare
2 optval number;
3 begin
4 execute createRZGSet('myp','miyapur',optval);
5 dbms_output.put_line('val returned is:'||optval);
6 end;
7 /remove the execute key word. it belongs to SQL Plus. in pl/sql you can just give the procedure name thats enought.
SQL> declare
2 optval number;
3 begin
4 createRZGSet('myp','miyapur',optval);
5 dbms_output.put_line('val returned is:'||optval);
6 end;
7 / -
Getting ORA-06512/ORA-00972 ERROR WHILE EXECUTING THE PROCEDURE????
Hi ,
while executing this procedure , I am getting follwoing errors:
Create or Replace procedure ADD_CUSTOM_INDEX is
INDX_NOT_EXIST Number;
CREATE_SQL_STATMENT VARCHAR2(1500);
ALTER_SQL_STATMENT VARCHAR2(150);
CURSOR C1 IS select INDEX_NAME,CREATE_DDL FROM W_CUSTOM_TEST, WC_COMPANY_G WHERE W_CUSTOM_TEST.SYS_TENANT_ID = WC_COMPANY_G.BU_ID;
BEGIN
for V_ROW in C1 loop
SELECT COUNT(USER_INDEXES.INDEX_NAME) INTO INDX_NOT_EXIST FROM USER_INDEXES WHERE USER_INDEXES.INDEX_NAME = V_ROW.index_name;
IF INDX_NOT_EXIST = 0 THEN
CREATE_SQL_STATMENT := ''|| '"'|| V_ROW.CREATE_DDL ||'"' ||'PARALLEL NOLOGGING';
EXECUTE IMMEDIATE CREATE_SQL_STATMENT;
ALTER_SQL_STATMENT := 'ALTER INDEX ' ||'"'|| V_ROW.INDEX_NAME ||'"'|| ' NOPARALLEL LOGGING';
EXECUTE IMMEDIATE ALTER_SQL_STATMENT;
END IF;
END LOOP;
END ADD_CUSTOM_INDEX;
ERROR at line 1:
ORA-00972: identifier is too long
ORA-06512: at "LOLAP.ADD_CUSTOM_INDEX", line 13
ORA-06512: at line 1.
sturtuce of W_custom_test table is as below:
CREATE TABLE "LOLAP"."W_CUSTOM_TEST"
("INDEX_NAME" VARCHAR2(30) NOT NULL ENABLE,
"SYS_TENANT_ID" VARCHAR2(15) NOT NULL ENABLE,
"CREATE_DDL" VARCHAR2(1200),
"COMMENTS" VARCHAR2(200),
"STAT_CD" VARCHAR2(30) DEFAULT 'Active' NOT NULL ENABLE,
"CREATED" DATE DEFAULT SYSDATE NOT NULL ENABLE,
"LAST_UPD" DATE DEFAULT SYSDATE NOT NULL ENABLE
Any Pointer??????Hi
Instead of giving as below, go for the not null constraints.
"STAT_CD" VARCHAR2(30) DEFAULT 'Active' NOT NULL ENABLE,
"CREATED" DATE DEFAULT SYSDATE NOT NULL ENABLE,
"LAST_UPD" DATE DEFAULT SYSDATE NOT NULL ENABLE
That should help
Regards
Sudheer -
How to execute the procedure in sap b1
Hai to all,
I done a procedure in sql server .but i don't know how to execute that procedure in sap b1?
can anyone help me immediately.
Regards,
Ramya.SDear Ramya.S,
You could execute the store procedure by using Recordset object in SDK DI code. It is like:
Dim myRecordSet As SAPbobsCOM.Recordset
myRecordSet =
SBO_Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecord
set)
myRecordSet.Command.Name = "TestStoredProcedure"
myRecordSet.Command.Parameters.Item("@ItemLike").Value = "IT%"
myRecordSet.Command.Parameters.Item(2).Value = "C0001"
myRecordSet.Command.Execute() -
Can you tell me how to execute the procedure?
create or replace get_dob
(ss_number varchar2,dob out date)
as
begin
select birth_dae
into dob
from person
where soc_sec_num=ss_num;
exception when no_data_found
error_notify(ss_num);
end;
the question is that when i want to execute this procedure,how can I use the command?
I try to use the "execute get_dob('wang');"in the sql/plus,but the system give me wrong information.Errors:
1. You left out the word PROCEDURE after CREATE OR REPLACE.
2. You used ss_number in one place and ss_num in two others. These must be the same name.
3. You left out the word THEN after WHEN NO_DATA_FOUND.
Possible errors:
1. Is birth_dae spelled correctly? Or, should it be birth_date?
2. Is error_notify a user-defined procedure?
Additional suggestions:
1. It is better to use table_name.column_name%TYPE instead of specifying NUMBER, VARCHAR2, DATE, etc. for your parameters. That way if the column data types are changed in the future, you don't have to change your code.
2. You will need to SET SERVEROUTPUT ON and use DBMS_OUTPUT.PUT_LINE to display the contents of the variable that holds the value of the out parameter.
3. Please see suggested code for creation of procedure and execution of procedure below. I have included one row of test data so that some output will be displayed. I commented out the exception section, in order to test it, since I don't have your error_notify procedure.
SQL> -- test data:
SQL> CREATE TABLE person
2 (birth_dae DATE,
3 soc_sec_num NUMBER)
4 /
Table created.
SQL> INSERT INTO person
2 VALUES (SYSDATE, '123456789')
3 /
1 row created.
SQL> SELECT * FROM person
2 /
BIRTH_DAE SOC_SEC_NUM
06-DEC-02 123456789
SQL>
SQL>
SQL> -- create procedure:
SQL> CREATE OR REPLACE PROCEDURE get_dob
2 (ss_number IN person.soc_sec_num%TYPE,
3 dob OUT person.birth_dae%TYPE)
4 AS
5 BEGIN
6 SELECT birth_dae
7 INTO dob
8 FROM person
9 WHERE soc_sec_num = ss_number;
10 -- EXCEPTION
11 -- WHEN NO_DATA_FOUND THEN
12 -- error_notify (ss_number);
13 END get_dob;
14 /
Procedure created.
SQL> SHOW ERRORS
No errors.
SQL>
SQL>
SQL> -- execute procedure:
SQL> SET SERVEROUTPUT ON
SQL> DECLARE
2 v_dob DATE;
3 BEGIN
4 get_dob ('123456789', v_dob);
5 DBMS_OUTPUT.PUT_LINE (v_dob);
6 END;
7 /
06-DEC-02
PL/SQL procedure successfully completed. -
Execute the Procedure automatically
Hello,
is it possible to execute a procedure for example every 5 minutes automatically?VARIABLE jobno number;
BEGIN
DBMS_JOB.SUBMIT(:jobno,
'proc;'
SYSDATE, 'SYSDATE + 5/1440');
commit;
END;
/See here for more information:
Re: trigger to copy old data
http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96612/d_job2.htm#1002030 -
Not able to execute the procedure
Hi everybody,
I am trying to execute a procedure as below,
CREATE OR REPLACE procedure test1(n1 IN number, n2 IN number, tot OUT number)
is
i number := null;
begin
loop
if n2>n1 then
i:=i+1;
tot:=n1+i;
dbms_output.put_line(tot);
elsif n2<n1 then
dbms_output.put_line('Enter a higher value for n2');
end if;
end loop;
end;
All im trying to do is to print the numbers according to the values we give during the runtime, but doesn't seem to work for me.
ie.,
n1=1;
n2=5;
tot = 1,2,3,4,5;
I am sorry if there are some error's in the procedure and would really appreciate if you can help me with this. Thanks in advance for your help.
Edited by: Pravin on 31 Aug, 2010 2:25 PMWhen i run the procedure now,
CREATE OR REPLACE procedure test1(n1 IN number, n2 IN number, tot OUT number)
is
i number := null;
begin
loop
if n2>n1 then
i:=i+1;
tot:=n1+i;
dbms_output.put_line(tot);
elsif n2<n1 then
dbms_output.put_line('Enter a higher value for n1');
end if;
exit;
end loop;
end;
set serveroutput on;
variable tot number;
execute test1(1,4,:tot);
print tot;
Im getting output as,
PL/SQL procedure successfully completed.
tot
Nothing is getting printed now. Any reasons for it. I would like to appreciate everybody's help, by the way. Hope we will find a solution.
Edited by: Pravin on 31 Aug, 2010 2:40 PM -
How to Execute the procedure?
Hi,
How to execute a below procedure with refcursor output parameter,
in that procedure refcursor declare in package
create or replace PROCEDURE prc_sam(
P_LIST OUT pkg_sam.REF_CURSOR_TYPE) IS
BEGIN
OPEN P_LIST FOR
SELECT 1+1 FROM dual;
EXCEPTION
WHEN OTHERS THEN
RAISE_APPLICATION_ERROR(-20001,SQLERRM);
END prc_sam;
Regards,
FameSQL> create or replace PROCEDURE prc_sam(
2 P_LIST OUT SYS_REFCURSOR) IS
3 BEGIN
4
5 OPEN P_LIST FOR
6 SELECT 1+1 FROM dual;
7 EXCEPTION
8 WHEN OTHERS THEN
9 RAISE_APPLICATION_ERROR(-20001,SQLERRM);
10 END prc_sam;
11 /
Procedure created.
SQL> VARIABLE P_CURSOR REFCURSOR;
SQL> EXEC prc_sam(:P_CURSOR);
PL/SQL procedure successfully completed.
SQL> PRINT P_CURSOR;
1+1
2
Intead of SYS_REFCURSOR, you can use ur pkg_sam.REF_CURSOR_TYPE inside a package
AND
execute a procedure like EXEC pkg_sam.prc_sam(:P_CURSOR);
like this, then you will get the result............................
Thanks,
Ann -
Execute the procedure has problem
Hi all,
I have the store procedure defined as
vn_trunc_data (name varchar(32), version integer);
I ran the command as below in sqlplus but I got the error message
execute vn_trunc_data('test', 1);
error message is ORA-06502: PL/SQL: numeric or value error: character to number conversion error ORA-06512: at line 1
Is the execute statement thas the correct syntax. Please help.
DPHi,
You have to check the assignment (of the variable 'version') inside the procedure.
Check the following...
ORA-06502: PL/SQL: numeric or value error string
Cause: An arithmetic, numeric, string, conversion, or constraint error occurred. For example, this error occurs if an attempt is made to assign the value NULL to a variable declared NOT NULL, or if an attempt is made to assign an integer larger than 99 to a variable declared NUMBER(2).
Action: Change the data, how it is manipulated, or how it is declared so that values do not violate constraints.
cheers. -
Business rule trigger not calling the procedure in my code
Good morning every one,
I have a small problem with two of my business rule triggers.
I have these tables:
pms_activity
csh_cash
csh_integrate_leh
csh_integrate_led
and my process goes like this:
upon approval of a row in my pms_activity table I have a trigger that insert a row in my csh_cash - and in the csh_cash table I have a trigger that will insert in the csh_ingerate_leh and csh_integrate_led.
my problem is pms_activity does generate a row in csh_cash but the trigger in the cash does not fire to generate a row in the csh_integrate_leh and led tables.
I have generated in the following order after I created my business rule:
I have generated the table from the designer (server module tab)
I have generated the CAPI from the head start utility
I have generated the API from the designer
I have generated the CAPI from the designer
I have run the recompil.sql
I have checked that my business rule trigger is enabled and should run on insert and no where restriction
=== this is my business rule logic ======
l_rule_ok boolean := true;
begin
trace('br_csh001_cev (f)');
csh_gl_pkg.csh_gen_integ_jvs(p_id
,p_ref_num
,p_own_id
,p_trt_id
,p_value_date
,p_description
,p_amount
,p_cur_id
,p_gla_dr
,p_gla_cr
,p_gla_pl
,p_gla_rev
,p_gla_eqt);
return l_rule_ok;
exception
when others
then
qms$errors.unhandled_exception(PACKAGE_NAME||'.br_csh001_cev (f)');
end br_csh001_cev;
==== end =======================
Any help will be appreciated as I have struggled with this for two days.
ThanksHaroon,
SAP does not allow Stored Procedures to be used as part of the SAP Business Db or to be used to access SAP Business One tables directly for Insert, Update or Delete. Any interaction with the SAP Business One Db is required to go through the SAP Business One API's, namely the DI and UI API's.
Eddy
Maybe you are looking for
-
Can I use IOBIT to remove ITUNES?
I have followed every suggestion, work around etc. to uninstall Itunes on my computer. Nothing works. Since all of my music is backed up, in mutiple places, I am ready to just erase Itunes from my computer and start again. Again, Windows Uninsta
-
How to select entire words in Illustrator CS4???
I've just upgraded to CS4, and Illustrator has lost the ability to select entire words. I can't even click on a point in the text and drag to the beginning or end. Can't double-click on a word. Can't click, then shift-click anywhere else. Nothing wor
-
So I forgot my iTunes security questions and I cant figure out how to reset them or change them, can someone help me please?
-
How do I get iTunes to display updates?
Ipad says I have 5 updates, but it won't display them in iTunes. Why? How do I get this to work so I can do the updates?
-
Box not included with refurb'd MBP?
I recently purchased a MacBook Pro 15" Retina (Mid 2012) from the Apple certified refurbished store. I am loving the computer except for one small detail. When I recieved the packaging from the delivery service, I noticed immediately that the MacBook