DBAsupport.com Forums - Powered by vBulletin
Results 1 to 7 of 7

Thread: Dynamic SQL

Threaded View

  1. #6
    Join Date
    May 2002
    Posts
    2,645
    Executing a single row select with a bind variable, fetching into a single define variable:

    Code:
    DECLARE   
      str varchar2(200);     
      val varchar2(20);     
      ret varchar2(20); 
    BEGIN    
      str := 'select msg from msg where msg = :b1';     
      val := 'Hello';     
      EXECUTE IMMEDIATE str INTO ret USING val;     
      dbms_output.put_line('Value fetched from table: '||ret); 
    END;
    Is tsql a number or varchar2? You declare it as a varchar2, but do a select count(*) - which would be a number.
    Last edited by stecal; 12-17-2002 at 02:57 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width