Home » RDBMS Server » Server Administration » substr on LONG datatype
substr on LONG datatype [message #52042] Thu, 27 June 2002 15:34 Go to next message
Eugene
Messages: 44
Registered: August 2001
Member
Hi all,
I need to select first 3 charactes of the LONG datatype column and getting an error: ORA-00932: inconsistent datatypes.
How to resolve it?
Re: substr on LONG datatype [message #52050 is a reply to message #52042] Fri, 28 June 2002 12:23 Go to previous messageGo to next message
andrew again
Messages: 2577
Registered: March 2000
Senior Member
Try this...
set serveroutput on

-- get the first 3 characters
DECLARE
   v_3char   VARCHAR2 (3);
BEGIN
   FOR i IN  (SELECT long_col FROM mytab)
   LOOP
      v_3char := SUBSTR (i.long_col, 1, 3);
      DBMS_OUTPUT.put_line (v_3char);
   END LOOP;
END;
/
Re: substr on LONG datatype [message #52052 is a reply to message #52042] Fri, 28 June 2002 13:13 Go to previous message
Eugene
Messages: 44
Registered: August 2001
Member
Andrew,
Thanks for reply.
Can I do it in one sql statement (not PL/sql block)?
Previous Topic: ALTER USER...... ADMIN OPTION
Next Topic: Please Make me clear.....
Goto Forum:
  


Current Time: Tue Sep 17 20:26:41 CDT 2024