Hi ,
I have a silly doubt in PLSQl....and am trying to settle the matter for the past 3 hours , but of no avail ! I just hope you guys can help me in this . its quite simple actually , but am too stressed out now to do R&D on this ! Well, here it is :
I need to do the following in a PLSQL : get the count of the number of records in a table and put them in a variable. Then if this value is greater than a preset value: say 2200 , then it should proceed to call another script (ex : @oracle_home\bin\test.sql)
Is this possible ? I have tried using cursors and all. just see the code and before laughing , be sure to post the solution !!!!
Thanks in advance .
set serveroutput on
-- *******. Automation Of Loader .******
DECLARE
CURSOR Check_Link_Employee IS
select count(*) from matc_employee_am ;
CURSOR Check_Link_Project IS
select count(*) from matc_proj_am ;
flag BOOLEAN;
emp_curr_rec emp_curr%ROWTYPE;
proj_curr_rec proj_curr%ROWTYPE;
empcounter NUMBER(5);
projcounter NUMBER(5);
BEGIN
open proj_curr;
open emp_curr ;
LOOP
fetch proj_curr into proj_curr_rec;
exit when proj_curr%NOTFOUND;
fetch emp_curr into emp_curr_rec;
exit when emp_curr%NOTFOUND;
projcounter := proj_curr_rec.count(*) ;
empcounter := emp_curr_rec.count(*) ;
IF (empcounter > 2200) then
dbms_output.put_line('Success ');
-- the script should come here
ELSE
dbms_output.put_line('Unable to process ');
END LOOP;
END;
/
Regards,
S. Jayaram Uparna .
If the need arises,you are welcome to mail me at oracguru@yahoo.com .
I have a silly doubt in PLSQl....and am trying to settle the matter for the past 3 hours , but of no avail ! I just hope you guys can help me in this . its quite simple actually , but am too stressed out now to do R&D on this ! Well, here it is :
I need to do the following in a PLSQL : get the count of the number of records in a table and put them in a variable. Then if this value is greater than a preset value: say 2200 , then it should proceed to call another script (ex : @oracle_home\bin\test.sql)
Is this possible ? I have tried using cursors and all. just see the code and before laughing , be sure to post the solution !!!!
Thanks in advance .
set serveroutput on
-- *******. Automation Of Loader .******
DECLARE
CURSOR Check_Link_Employee IS
select count(*) from matc_employee_am ;
CURSOR Check_Link_Project IS
select count(*) from matc_proj_am ;
flag BOOLEAN;
emp_curr_rec emp_curr%ROWTYPE;
proj_curr_rec proj_curr%ROWTYPE;
empcounter NUMBER(5);
projcounter NUMBER(5);
BEGIN
open proj_curr;
open emp_curr ;
LOOP
fetch proj_curr into proj_curr_rec;
exit when proj_curr%NOTFOUND;
fetch emp_curr into emp_curr_rec;
exit when emp_curr%NOTFOUND;
projcounter := proj_curr_rec.count(*) ;
empcounter := emp_curr_rec.count(*) ;
IF (empcounter > 2200) then
dbms_output.put_line('Success ');
-- the script should come here
ELSE
dbms_output.put_line('Unable to process ');
END LOOP;
END;
/
Regards,
S. Jayaram Uparna .
If the need arises,you are welcome to mail me at oracguru@yahoo.com .