i have following two queries, one is create procedure query and other is the call to the same procedure.
they both run fine when running indiviually, but when i try to run them together in one go i get errors: like executed with warnings and the results are not proper with that.
can you please tell me how can i achieve this? may be it has to do soem thing with execute immediate , but i am new to this so dont know how to convert my first query to be executed with execute immediate.
Thanks in advance Ashish
CREATE or replace PROCEDURE DP_DROP_FKEY_PROC (NS IN varchar2,
NM IN varchar2, FK IN varchar2)
IS
S VARCHAR2(150) := '';
I NUMBER;
BEGIN
I := 0;
SELECT COUNT(*) INTO I FROM ALL_CONSTRAINTS C
WHERE (C.OWNER = NS) AND (C.TABLE_NAME = NM) AND (C.CONSTRAINT_NAME = FK) ;
IF (I = 1) THEN
S := 'ALTER TABLE "' || NS || '"."' || NM || '" DROP CONSTRAINT "' || FK || '"';
EXECUTE IMMEDIATE S;
END IF;
END;
CALL DP_DROP_FKEY_PROC('SomeOwnerName', 'TableName', 'ConstraintName');