error-cursor

Dúvidas, dicas e truques de PL/SQL. Aqui também vão assuntos relacionados a pacotes, triggers, funções, Java-Stored Procedures, etc
  

Poston Tue, 06 Dec 2005 11:54 am

This happening the following error: ORA-06502: PL/SQL: error: character conversion error in numeric number or value table estrura (colors)-> fields: cod (number) and color (varchar2) Cursor q is generating the error:
Code: Select all
declare
  cursor c_cursor is
    select cor, cod from cores;
  v_cod cores.cod%TYPE;
  v_cor cores.cor%TYPE;
begin
  open c_cursor;
  loop
    fetch c_cursor into v_cod,v_cor;
  exit when c_cursor%NOTFOUND;
  dbms_output.put_line((v_cod) || '-' ||(v_cor));
  end loop;
  close c_cursor;
end;
Help!Please! :-)
izaura
Location: santos-sp

Poston Tue, 06 Dec 2005 12:10 pm

Hello, invert the color fields and cod in your cursor ... as in the example below.

Code: Select all
DECLARE
CURSOR c_cursor IS
  SELECT cod, cor
    FROM cores;
  v_cod cores.cod%TYPE;
  v_cor cores.cor%TYPE;
BEGIN
  OPEN c_cursor;
  LOOP
    FETCH c_cursor INTO v_cod, v_cor;
    EXIT WHEN c_cursor%NOTFOUND;
      dbms_output.put_line((v_cod)|| '-' ||(v_cor));
  END LOOP;
CLOSE c_cursor;
END;
this error occurred because you selected the color fields and then code and made into code and color fields, getting reversed ... must use the same sequence of fields in the select and on into.

[]´s

:-o
anderson
Location: Toledo - PR

Anderson Nuernberg
---


  • See also
    Replies
    Views
    Last Post


      Return to PL/SQL

      Who is online

      Users browsing this forum: No registered users and 1 guest

cron