froiland31 de Marzo del 2005
PreguntaPues eso , quiero hacer un drop synonym para todos ellos q se hace con sql dinamico pero me esta dando fallos.
Este es el codigo:
declare
PRAGMA Restrict_References;
rows_processed NUMBER;
cur_hdl NUMBER;
stmt_str VARCHAR2(1000);
cursor v_t is select synonym_name
from dba_synonyms
where table_owner='RASC';
v_c dba_constraints.table_name%TYPE;
v_cons dba_constraints.constraint_name%type;
begin
open v_t;
fetch v_t into v_c;
while v_t%FOUND loop
stmt_str := 'drop public synonym :v_1';
cur_hdl := DBMS_SQL.OPEN_CURSOR;
DBMS_SQL.PARSE (cur_hdl,stmt_str,DBMS_SQL.NATIVE);
DBMS_SQL.BIND_VARIABLE(cur_hdl,':v_1',v_c);
rows_processed := dbms_sql.execute(cur_hdl);
DBMS_SQL.CLOSE_CURSOR(cur_hdl);
--dbms_output.put_line(v_c);
fetch v_t into v_c;
end loop;
close v_t;
end;
Gracias
Este es el codigo:
declare
PRAGMA Restrict_References;
rows_processed NUMBER;
cur_hdl NUMBER;
stmt_str VARCHAR2(1000);
cursor v_t is select synonym_name
from dba_synonyms
where table_owner='RASC';
v_c dba_constraints.table_name%TYPE;
v_cons dba_constraints.constraint_name%type;
begin
open v_t;
fetch v_t into v_c;
while v_t%FOUND loop
stmt_str := 'drop public synonym :v_1';
cur_hdl := DBMS_SQL.OPEN_CURSOR;
DBMS_SQL.PARSE (cur_hdl,stmt_str,DBMS_SQL.NATIVE);
DBMS_SQL.BIND_VARIABLE(cur_hdl,':v_1',v_c);
rows_processed := dbms_sql.execute(cur_hdl);
DBMS_SQL.CLOSE_CURSOR(cur_hdl);
--dbms_output.put_line(v_c);
fetch v_t into v_c;
end loop;
close v_t;
end;
Gracias
