Results 1 to 3 of 3

Thread: PL/SQL (multiple row queries :( ).

  1. #1
    Huggable
    Join Date
    Jul 2004
    Location
    Manchester
    Posts
    688
    Thanks
    0
    Thanked
    0 times in 0 posts
    • Starburn's system
      • Motherboard:
      • Epox 9NPA+
      • CPU:
      • A64 4000+ (@ 12x210)
      • Memory:
      • 2x1gig Corsair XMS Pro (DDR400 @ 420)
      • Storage:
      • 2x80gig Raid0 & 1x200gig
      • Graphics card(s):
      • ATI Radeon X1800XT (above stock)
      • PSU:
      • Hiper Type-R Modular (580W)
      • Case:
      • Coolermaster Wave
      • Monitor(s):
      • 19" TFT & 50" TV (for games)
      • Internet:
      • Be 24mb

    Exclamation PL/SQL (multiple row queries :( ).

    I have an SQL statement that returns multiple rows.. (two columns)..

    and I can't seem to figure out how to use it within a PL/SQL procedure using two parameters from the procedure.

    I've tried using records/tables (until I discovered PL/SQL tables can only be one column), and currently "EXECUTE IMMEDIATELY".. which works (i.e. compiles/executes) but the output from the SQL statement is not displayed.



    Code:
    CREATE OR REPLACE PROCEDURE testList
    (title VARCHAR2,
     type VARCHAR2)
    AS
      getList VARCHAR2(500);
    BEGIN
      getList := '<the SQL statement>';
      EXECUTE IMMEDIATE getList USING title, type;
    END testList;
    /
    We cannot choose what we are.. but what are we but the sum of our choices?

  2. #2
    Huggable
    Join Date
    Jul 2004
    Location
    Manchester
    Posts
    688
    Thanks
    0
    Thanked
    0 times in 0 posts
    • Starburn's system
      • Motherboard:
      • Epox 9NPA+
      • CPU:
      • A64 4000+ (@ 12x210)
      • Memory:
      • 2x1gig Corsair XMS Pro (DDR400 @ 420)
      • Storage:
      • 2x80gig Raid0 & 1x200gig
      • Graphics card(s):
      • ATI Radeon X1800XT (above stock)
      • PSU:
      • Hiper Type-R Modular (580W)
      • Case:
      • Coolermaster Wave
      • Monitor(s):
      • 19" TFT & 50" TV (for games)
      • Internet:
      • Be 24mb
    ah I've figured out you use a dynamic cursor..

    now I'm just having fun trying to fetch the values from the cursor :/
    "ORA-00932: inconsistent datatypes: expected - got -"
    We cannot choose what we are.. but what are we but the sum of our choices?

  3. #3
    Senior Member GAteKeeper's Avatar
    Join Date
    Feb 2004
    Location
    Derbyshire, UK
    Posts
    584
    Thanks
    14
    Thanked
    34 times in 23 posts
    • GAteKeeper's system
      • Motherboard:
      • MSI P67-GD5
      • CPU:
      • Intel i7 2600k
      • Memory:
      • 8Gb Corsair DDR3 1600
      • Storage:
      • ~44TB
      • Graphics card(s):
      • 980Ti
      • PSU:
      • Seasonic S12 600W
      • Case:
      • Lian Li PC-65
      • Operating System:
      • Win10 64bit
      • Monitor(s):
      • Dell U3415W & 2405fpw
      • Internet:
      • 45Mb vDSL
    If you are using 9i v2 onwards you can use multi-dimensional tables

    type my_table as table of real_table%rowtype;
    var_table my_table;

    or somet like that.

    but Y not use early binding?

    Code:
    CREATE OR REPLACE PROCEDURE testList
    (title VARCHAR2,
     type VARCHAR2)
    AS
    BEGIN
         Update my_table 
           set my_column = type
           where my_title = title;
    END testList;
    its good practice to name your procedural variables with a pre-fix such as var_ or int_ or str_ so that there is less chance of a naming mix up with table column names.

    GAteKeeper
    Keeper of the Gates of Hell

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Multiple action listeners in one class
    By Kezzer in forum Software
    Replies: 11
    Last Post: 22-04-2005, 05:20 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
  •