Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2003
    Posts
    74

    Arrow Unanswered: About retrieve data from a dynamic ResultSet in SQL stored procedure

    How can I retrieve a field value in results sets by the name of field or the number of field in SQL stored procedure like ResultSet.getXXX() procedure in JDBC. Because the field list will be changed while the caller call it every time.

    create procedure dyna_cursor(in SOURCE varchar(128),
    in FIELDLIST varchar(1000))
    dynamic result sets 1
    language sql
    begin
    declare stmt varchar(1024);
    declare at_end int default 0;

    declare CONTINUE HANDLER FOR NOT FOUND
    set at_end = 1;

    set stmt = 'select '||FIELDLIST||' from '||SOURCE;
    prepare ps from stmt;
    declare c1 cursor with return to caller for ps;
    open c1;
    end

    --comment: the FIELDLIST is a list of fields in SOURCE table.

    In another SQL stored procedure I will call the DYNA_CURSOR SQL stored procedure. I can't predifine the number and the type of fields included in the FIELDLIST variable, so I can't pre-declare variables corresponding the fields included in the FIELDLIST variable in another SQL procedure. How can I dynamic get the field-value returned by the dyna_cursor.

    Thanks for all your help!

  2. #2
    Join Date
    Jan 2003
    Posts
    74
    is it possible to use SQL Descriptor areas into SQL Stored Procedures ? What
    I wan to to do is to use the statment :

    EXECUTE mystat USING DESCRIPTOR mysqlda;

    in a SQL Stored Procedure.

  3. #3
    Join Date
    Jan 2003
    Posts
    74

    Arrow

    Who can answer this problem?

  4. #4
    Join Date
    Jan 2003
    Posts
    74
    Thank you for your help! But I can't get the field value as the old. Because I can't dynamic declare those variables corresponding the values returned from DYNA_CURSOR procedure in another SQL procedure.

Posting Permissions

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