Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2003
    Posts
    294

    Lightbulb Unanswered: Table Using cursor

    Hello there, I'm having this problem, when I create a table, using a cursor rowtype (something like this):


    TYPE tabDatosHistorico IS TABLE OF curCobertCt%ROWTYPE INDEX BY BINARY_INTEGER;
    tabHistoricoAfi tabDatosHistorico;


    OPEN curDatosA FOR
    SELECT HistoricoAfi.*
    FROM TABLE (CAST(tabHistoricoAfi AS tabDatosHistorico))HistoricoAfi
    WHERE HistoricoAfi.NPOLIZA = '094000105';


    Later I recive the error: 'invalid data type'
    when I try to open a new cursos using the table I created before.
    Is that the correct way to open this kind of table ???

    How do I do It?

  2. #2
    Join Date
    Jul 2003
    Posts
    2,296
    i don't think you need to do all that.

    just issue:
    PHP Code:
    declare

      
    cursor curDatosA is
        select 
    from HistoricoAfi;

    begin

      
    for vDatasA in curDatasA loop

        
    if vDatasA.NPOLIZA '094000105' then
          
    /* execute your code */
        
    end if;
      
    end loop;
    end;

    - The_Duck
    you can lead someone to something but they will never learn anything ...

  3. #3
    Join Date
    Jun 2003
    Posts
    294
    But I really have to have the table !!!

  4. #4
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1
    You can only perform SQL on collection types defined in the server like this:

    SQL> CREATE TYPE DatosHistorico IS OBJECT (id INTEGER, name VARCHAR2(30), ...);

    SQL> CREATE TYPE tabDatosHistorico IS TABLE OF DatosHistorico;

    No PL/SQL syntax is allowed there, so you can't use %ROWTYPE.

  5. #5
    Join Date
    Apr 2004
    Posts
    246
    Could this be what you meant to do?

    OPEN curDatosA FOR
    SELECT HistoricoAfi.*
    FROM curCobertCt HistoricoAfi
    WHERE HistoricoAfi.NPOLIZA = '094000105';


    RTFM
    Give a man a fish, you feed him for a day. Club him over the head with a fish, he'll leave you alone.

Posting Permissions

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