lundi 17 juin 2019

Oracle: How to call a stored procedure within a stored procedure with if-condition

I have to call a procedure ("B") (in Oracle 10g) within a procedure ("A") with an if-condition. But I can't get it work.

Procedure "B" collects data from several tables and writes it to an xml-file. If I call "B" without condition, it writes the file. But it writes the file (with the xml-Header) wether there is data or not. So I need the if-condition to check for data.

The code:

CREATE OR REPLACE PROCEDURE A
AS
 l_count varchar2(3);

 CURSOR c_EXISTSDATA IS
   select count(*) into l_count from bv.history where upddate > sysdate -.015 and tabelle = 'MEDIEN' and userid != 'DATENTAUSH';

BEGIN
IF (l_count != 0)
THEN
B;
END IF;
END;
/

With this if-condition there is not output at all - also if l_count !=0. What is wrong here?

Thank's for help! Regards Christoph

Aucun commentaire:

Enregistrer un commentaire