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

Thread: get every result of a query to use after in other query

  1. #1
    Join Date
    Jul 2014
    Posts
    1

    get every result of a query to use after in other query

    I'm trying to get every result of a query to then print an output and make other query with the result. I'm trying to make it with a Cursor. But when I try to print the query result it says me:

    Code:
    PLS-00306: wrong number or types of arguments in call to 'PUT_LINE'
    My code is:

    Code:
    DECLARE
    -- Store the SELECT query in a cursor
      CURSOR l_cur IS select memname from emuser.DEF_TABLES@controlm t, emuser.DEF_JOB@controlm j where (t.TABLE_ID = j.TABLE_ID) and t.sched_table = 'DWHRAC_DIARIOS2_DC2'; 
    --Create a variable that will hold each result from the cursor
      l_cur_rec l_cur%ROWTYPE;
    BEGIN
      -- Open the Cursor so that we may retrieve results
      OPEN l_cur;  
      LOOP
        -- Get a result from the SELECT query and store it in the variable
        FETCH l_cur INTO l_cur_rec;
        -- EXIT the loop if there are no more results
        EXIT WHEN l_cur%NOTFOUND;
        -- INSERT INTO another table that has the same structure as your results
                  DBMS_OUTPUT.PUT_LINE( l_cur_rec);
                   --here I write the other query---
    
      END LOOP;
      -- Close the cursor to release the memory
      CLOSE l_cur;
    END
    ;
    Could you help me please? Thanks

  2. #2
    Join Date
    Jul 2002
    Location
    Lake Worth, FL
    Posts
    1,492
    Quote Originally Posted by mmm286 View Post
    I'm trying to get every result of a query to then print . . . an output and make other query with the result. I'm trying to
    make it with a Cursor. But when I try to print the query result it says me:

    Code:
    PLS-00306: wrong number or types of arguments in call to 'PUT_LINE'
    . . . E t c . . .

    Could you help me please? Thanks
    And what is it you do not understand about the PLS-00306 error?
    PLS-00306: wrong number or types of arguments in call to 'string'

    Cause: This error occurs when the named subprogram call cannot be matched to any declaration for that subprogram name.
    The subprogram name might be misspelled, a parameter might have the wrong datatype, the declaration might be faulty,
    or the declaration might be placed incorrectly in the block structure.
    For example, this error occurs if the built-in square root function SQRT is called with a misspelled name or with a parameter of the wrong datatype.

    Action: Check the spelling and declaration of the subprogram name. Also confirm that its call is correct, its parameters are of the right datatype,
    and, if it is not a built-in function, that its declaration is placed correctly in the block structure.
    "The person who says it cannot be done should not interrupt the person doing it." --Chinese Proverb

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