How to Concatenate a long with varchar in a SELECT statement?
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 2 of 2

Thread: How to Concatenate a long with varchar in a SELECT statement?

  1. #1
    Join Date
    Sep 2001
    Location
    Mexico
    Posts
    93

    How to Concatenate a long with varchar in a SELECT statement?

    Hi, I would like to concatenate a long with varchar in order to generate a sql script by using sql*plus.

    This is my code:

    SPOOL RES.TXT

    SELECT 'CREATE TABLE '||TABLE_NAME||' AS ('||QUERY||' WHERE 1=0)' FROM DBA_SNAPSHOTS WHERE OWNER='MAZINGER';

    SPOOL OFF

    I cannot concatenate the field QUERY with the rest of the information ('CREATE TABLE ...') because it has the datatype LONG.

    Any ideas to solve this problem?

    Thanks in advance.

    Regards

  2. #2
    Join Date
    May 2001
    Location
    San Francisco, California
    Posts
    510
    select the LONG into varchar2 (upto 4000 bytes) and then concatenate.
    Last edited by kris109; 01-23-2004 at 01:05 AM.
    Remember the Golden Rule - He who has the gold makes the rules!
    ===================
    Kris109
    Ph.D., OCP 8i, 9i, 10g, 11g DBA

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