SQL_TEXT in V$SQL getting truncated
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 6 of 6

Thread: SQL_TEXT in V$SQL getting truncated

  1. #1
    Join Date
    Apr 2001
    Posts
    54

    SQL_TEXT in V$SQL getting truncated

    I am querying V$SQL and the results of SQL_TEXT are getting truncated. Is there an easy way to remedy this, like a SET command?

    Thanks
    -mcslain

  2. #2
    Join Date
    Apr 2008
    Location
    Bangalore
    Posts
    96
    usually the text will be displayed in inverted format....

  3. #3
    Join Date
    Mar 2007
    Location
    Ft. Lauderdale, FL
    Posts
    3,554
    get all "pieces" together ordered by "piece" then parse it
    Pablo (Paul) Berzukov

    Author of Understanding Database Administration available at amazon and other bookstores.

    Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.

  4. #4
    Join Date
    Mar 2006
    Location
    Charlotte, NC
    Posts
    865
    also "set long" env. variable to a higher value.

    Thanks,
    Vijay Tummala

    Try hard to get what you like OR you will be forced to like what you get.

  5. #5
    Join Date
    Jun 2000
    Location
    Madrid, Spain
    Posts
    7,447
    v$sql does NOT show you the entire SQL statements, you need to query v$sqltext_with_newlines until 9i, in 10g you can query sql_fulltext in v$sqlstats (for this one you have to use set long to a hugh value)

  6. #6
    Join Date
    Mar 2006
    Location
    Charlotte, NC
    Posts
    865
    agree with you Pando. Poster can use sql_fulltext instead of sql_text even from v$sql.

    Mcslain - you can get the complete sql from v$sql.sql_fulltext or v$sqltext.sql_text (order by piece) or from v$sqlstats.sql_fulltext. Advantage with v$sqlstats is you can find the SQL even after the cursor aged out of shared pool.

    SQL> set long 50000
    SQL> set line 100
    SQL> select sql_fulltext from v$sql where hash_value=xxxxxxxxxx; or
    SQL> select sql_text from v$sqltext where hash_value=xxxxxxxx order by piece; or
    SQL> select sql_fulltext from v$sqlstats where plan_hash_value=xxxxxxxxxx;

    Thanks,
    Vijay Tummala

    Try hard to get what you like OR you will be forced to like what you get.

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