Execute Immediate with Cursor

Dúvidas, dicas e truques de PL/SQL. Aqui também vão assuntos relacionados a pacotes, triggers, funções, Java-Stored Procedures, etc
Post Reply
mrj
Rank: Estagiário Pleno
Rank: Estagiário Pleno
Posts: 6
Joined: Mon, 16 Jan 2006 7:27 am
Location: Rio de janeiro - RJ

To rotate the PL below Return error, is this correct the scope of the PL?
I need help .... the most urgent possible.

Select all

declare 
msg varchar2(5000); 
resp varchar2(1000); 
begin 
for c in ( select distinct table_name,column_name 
           from all_cons_columns  
           where table_name like 'DIM%'  
           and constraint_name like '%FK'  
           and owner = 'MDW' 
           order by table_name) loop 
      msg := 'SELECT COUNT(*) FROM ' || c.table_name || ' WHERE ' || c.column_name ||  '= -1;'; 
      EXECUTE IMMEDIATE msg  into resp; 
    --  execute immediate 'SELECT COUNT(1) FROM ' || c.table_name  || ';'   
      --into msg; 
      dbms_output.put_line (msg);    
  end loop; 
end;
gilbertoca
Rank: DBA Sênior
Rank: DBA Sênior
Posts: 372
Joined: Tue, 24 Jan 2006 3:33 pm
Location: Palmas - TO
Contact:

What a mistake?
What do you want to do?
Maybe what you are looking for is ready. Look for in the forum!

Gilberto
User avatar
dr_gori
Moderador
Moderador
Posts: 5024
Joined: Mon, 03 May 2004 3:08 pm
Location: Portland, OR USA
Contact:
Thomas F. G

Você já respondeu a dúvida de alguém hoje?
https://glufke.net/oracle/search.php?search_id=unanswered

It seems that the problem is; which has after -1.
I took it and the routine worked.

Another thing: your dbms_output is showing the select and not the resp.
User avatar
MuLtAnI
Moderador
Moderador
Posts: 90
Joined: Tue, 01 Jun 2004 9:21 am
Location: Videira - SC
Contact:

Just complementing

dbms_output.put_line (resp);

[] 's
Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 18 guests