Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2004

    Unanswered: Stored Procedures with Dynamic Select's Update's and Delete's


    All examples i have seen about dynamic sql within stored procedures, isn't actually dynamic sql, its more like late binding since they pass arguments to look for...

    What im looking for is something like passing the columns has arguments...
    For example...
    SELECT :Column1 :Column2 etc etc
    FROM :Table

    How can i accomplish that in PL/SQL Stored Procedures or Java Stored Procedures.

    Thx a lot.
    Best regards,
    Mauro Farracha

  2. #2
    Join Date
    Aug 2003
    Massachusetts, USA
    Refer to IBM documentation about cursors to process result set but to get you started:
    DECLARE v_sql varchar(1000);
    DECLARE v_dynamic statement;

    SET v_sql = 'SELECT ' || column1 || ', ' || column 2 || ' FROM sometable WHERE ....'
    PREPARE v_dynamic FROM v_sql;

Posting Permissions

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