Viewing Binary data in SQL*PLUS

hi all,
when i select a table to view the content, i received an error which i shown below.
SP2-0678: Column or attribute type can not be displayed by SQL*Plus
the error seems that the binary data cannot be view thru SQL PLUS.
do anybody have idea to solve this issue.
thanks in advance
karthik.J

Probably you are trying to view BLOB data. Try this to view the data:
SQL> CREATE TABLE t (a BLOB)
  2  /
Table created.
SQL> INSERT INTO t
  2       VALUES (UTL_RAW.cast_to_raw ('Hello World'))
  3  /
1 row created.
SQL> SELECT UTL_RAW.cast_to_varchar2 (a) a
  2    FROM t
  3  /
A
Hello World

Similar Messages

  • Apex 4.0 - Can see view data in SQL*Plus but no data in Object Browser

    Hi There,
    I have just started using Apex 4.o and migrated some apps. I have an issue with a report, but see the same issue with Object browser, which is easier to describe.
    I have a view:
    create or replace view V_PLJ_USERDEF_CODES (
             CODE_SET_ID,
             CODE_SET_CODE,
             CODE_SET_DESC,
             CODE_ID,
             CODE_SYS_CODE,
             CODE_VALUE,
             CODE_DESC,
             DISPLAY_SEQ,
             DISPLAY_FLAG,
             LANGUAGE_CODE) as
      select CS.CODE_SET_ID,
             CS.CODE_SET_CODE,
             CS.CODE_SET_DESC,
             C.CODE_ID,
             C.CODE_SYS_CODE,
             C.CODE_VALUE,
             C.CODE_DESC,
             C.DISPLAY_SEQ,
             C.DISPLAY_FLAG,
             C.LANGUAGE_CODE
        from PLJ_CODES C,
             PLJ_CODE_SETS CS
       where C.CODE_SET_ID         = CS.CODE_SET_ID
         and CS.CODE_SET_TYPE_CODE = SYS_CONTEXT('PLJUMPSTART','C_USERDEF_CODE_SET');This returns data in SQL*Plus, but no data in Object Browser OR report region based on this view.
    Workspace parses in the same schema as tested in SQL*Plus.
    If, in report, I swap out view, and use underlying table - no problem.
    Any ideas -
    thanks
    P

    Hi all,
    Thanks for getting back so promptly.
    It just seems weird to me, as tables are just fine, but not views.
    In the underlying schema:
    SQL> sho user
    USER is "ICSREPORTING"
    SQL> select count(*) from plj_codes;
      COUNT(*)
           107
    SQL> select count(*) from v_plj_userdef_codes;
      COUNT(*)
            29And in the APEX schema
    SQL> sho user
    USER is "APEX_040000"
    SQL> select count(*) from icsreporting.plj_codes;
    select count(*) from icsreporting.plj_codes
    ERROR at line 1:
    ORA-00942: table or view does not exist
    SQL> select count(*) from icsreporting.v_plj_userdef_codes;
    select count(*) from icsreporting.v_plj_userdef_codes
    ERROR at line 1:
    ORA-00942: table or view does not exist
    SQL>However, in SQL browser, I can see the data in PLJ_CODES but in V_PLJ_USERDEF_CODES, just the message "This view has no data". Indeed, it is like this for all views.
    I even explicitly granted access to APEX_040000 but no good.
    In fact, I would like to know more about how Apex gets access to do DML against the underlying parsing schema(s).
    This is a little frustrating though. It worked just fine in lots of apps in version 2.1 to 3.2
    Am I missing something
    paul
    p.s I knew there would be a question about the context, but I had already checked that. :)
    Edited by: PJ on Nov 19, 2010 4:09 AM

  • View CLOB data in SQL Developer

    Hi,
    Can anyone let me know how to view CLOB data in SQL Developer 2.1.
    I am having images stored in a column of datatype CLOB. How to view this image.
    Database is 10.2.0.4.

    Since SQL Developer has no idea about the type of data stored in LOB columns, one cannot view that content in desired format.
    You need a tool to extract the LOB data and render it accordingly.
    BTW, do you mean BLOB here?

  • How to view clob data using sql

    Hi,
    In our database, we have one table that is having one column of CLOB datatype but now i want to view the data using sql select query but it throws error: "Datatype not supported".
    Could any one please let me know how to view the clob data using select query.
    Oracle DB version : 10.2.0.3
    Thanks

    h5.
    use read procedure
    PROCEDURE READ (
    lobsrc IN BFILE|BLOB|CLOB ,
    amount IN OUT BINARY_INTEGER,
    offset IN INTEGER,
    buffer OUT RAW|VARCHAR2 );
    example  Updating LOB by Using DBMS_LOB in PL/SQL
    DECLARE
    lobloc CLOB; -- serves as the LOB locator
    text VARCHAR2(32767):='Resigned: 5 August 2000';
    amount NUMBER ; -- amount to be written
    offset INTEGER; -- where to start writing
    BEGIN
    SELECT resume INTO lobloc
    FROM employees
    WHERE employee_id = 405 FOR UPDATE;
    offset := DBMS_LOB.GETLENGTH(lobloc) + 2;
    amount := length(text);
    DBMS_LOB.WRITE (lobloc, amount, offset, text );
    text := ' Resigned: 30 September 2000';
    SELECT resume INTO lobloc
    FROM employees
    WHERE employee_id = 170 FOR UPDATE;
    amount := length(text);
    DBMS_LOB.WRITEAPPEND(lobloc, amount, text);
    COMMIT;
    END;

  • How to get Arabic dates in SQL*Plus?

    I want to do a very simple thing.
    I want to type in Arabic and Display dates in Arabic.
    Instead i get ????? ??????? ????? ??????? ? ? ???????, ????? for this?
    Why is this?
    I then changed my Windows XP "Regional and Language Options" all to Arabic. Now, I get AR (Arabic) in my language selection bar at the bottom of the Desktop. When I choose AR I can type Arabic in Notepad. ُ
    Even HERE I can type in Arabic: فغحث غخعق ةثسسشلث اثقث
    But in Sql*PLus I get ????? ??????? ????? ??????? ? ? ???????, ?????
    If I choose AR in SQL Plus and type in Arabic I get garbage characters?
    How to get Arabic in Sql*Plus?
    SQL> SHOW USER
    USER is "ARABDTEST"
    SQL> SELECT * FROM v$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
    PL/SQL Release 11.1.0.6.0 - Production
    CORE    11.1.0.6.0      Production
    TNS for 32-bit Windows: Version 11.1.0.6.0 - Production
    NLSRTL Version 11.1.0.6.0 - Production
    SQL> SELECT * FROM nls_session_parameters;
    PARAMETER                      VALUE
    NLS_LANGUAGE                   AMERICAN
    NLS_TERRITORY                  AMERICA
    NLS_CURRENCY                   $
    NLS_ISO_CURRENCY               AMERICA
    NLS_NUMERIC_CHARACTERS         .,
    NLS_CALENDAR                   GREGORIAN
    NLS_DATE_FORMAT                DD-MON-RR
    NLS_DATE_LANGUAGE              AMERICAN
    NLS_SORT                       BINARY
    NLS_TIME_FORMAT                HH.MI.SSXFF AM
    NLS_TIMESTAMP_FORMAT           DD-MON-RR HH.MI.SSXFF AM
    NLS_TIME_TZ_FORMAT             HH.MI.SSXFF AM TZR
    NLS_TIMESTAMP_TZ_FORMAT        DD-MON-RR HH.MI.SSXFF AM TZR
    NLS_DUAL_CURRENCY              $
    NLS_COMP                       BINARY
    NLS_LENGTH_SEMANTICS           BYTE
    NLS_NCHAR_CONV_EXCP            FALSE
    17 rows selected.
    SQL> ALTER SESSION set NLS_DATE_LANGUAGE = 'ARABIC';
    Session altered.
    SQL> SELECT TO_CHAR(SYSDATE, 'RRRR/MM/DD YEAR MONTH DAY MON DY AM PM DL') FROM dual;
    TO_CHAR(SYSDATE,'RRRR/MM/DDYEARMONTHDAYMONDYAMPMDL')
    2013/04/08 TWENTY THIRTEEN ?????  ???????  ?????  ???????  ? ? ???????, ????? 08, 2013
    SQL> ALTER SESSION set NLS_DATE_LANGUAGE = 'AMERICAN';
    Session altered.
    SQL>  SELECT TO_CHAR(SYSDATE, 'RRRR/MM/DD YEAR MONTH DAY MON DY AM PM DL') FROM dual;
    TO_CHAR(SYSDATE,'RRRR/MM/DDYEARMONTHDAYMONDYAMPMDL')
    2013/04/08 TWENTY THIRTEEN APRIL     MONDAY    APR MON PM PM Monday, April 08, 2013
    SQL> SELECT * FROM nls_database_parameters;
    PARAMETER                      VALUE
    NLS_LANGUAGE                   AMERICAN
    NLS_TERRITORY                  AMERICA
    NLS_CURRENCY                   $
    NLS_ISO_CURRENCY               AMERICA
    NLS_NUMERIC_CHARACTERS         .,
    NLS_CHARACTERSET               WE8MSWIN1252
    NLS_CALENDAR                   GREGORIAN
    NLS_DATE_FORMAT                DD-MON-RR
    NLS_DATE_LANGUAGE              AMERICAN
    NLS_SORT                       BINARY
    NLS_TIME_FORMAT                HH.MI.SSXFF AM
    NLS_TIMESTAMP_FORMAT           DD-MON-RR HH.MI.SSXFF AM
    NLS_TIME_TZ_FORMAT             HH.MI.SSXFF AM TZR
    NLS_TIMESTAMP_TZ_FORMAT        DD-MON-RR HH.MI.SSXFF AM TZR
    NLS_DUAL_CURRENCY              $
    NLS_COMP                       BINARY
    NLS_LENGTH_SEMANTICS           BYTE
    NLS_NCHAR_CONV_EXCP            FALSE
    NLS_NCHAR_CHARACTERSET         AL16UTF16
    NLS_RDBMS_VERSION              11.1.0.6.0
    20 rows selected.

    I am not sure SQL*Plus in character mode can display Arabic characters on Windows. OTN NLS_LANG FAQ http://www.oracle.com/technetwork/products/globalization/nls-lang-099431.html#_Toc105389288 says:
    >
    if you are testing with "special" characters please DO use the GUI and not the "DOS box" sqlplus.exe !
    >
    SQL*Plus GUI is not available with 11G: you should use SQL Developer.

  • How to see Chinese data using SQL Plus?

    Hi,
    Is it possible to see the Chinese character string saved in the database by using English version Sql Plus? The following data is set up in the table NLS_DATABASE_PARAMETERS in my oracle database. I'm really appreciated if anybody could help me.
    Thanks,
    Suwei Ma
    [email protected]
    PARAMETER VALUE
    NLS_LANGUAGE AMERICAN
    NLS_TERRITORY AMERICA
    NLS_CURRENCY $
    NLS_ISO_CURRENCY AMERICA
    NLS_NUMERIC_CHARACTERS .,
    NLS_CHARACTERSET UTF8
    NLS_CALENDAR GREGORIAN
    NLS_DATE_FORMAT DD-MON-RR
    NLS_DATE_LANGUAGE AMERICAN
    NLS_SORT BINARY
    NLS_TIME_FORMAT HH.MI.SSXFF AM
    PARAMETER VALUE
    NLS_TIMESTAMP_FORMAT DD-MON-RR HH.MI.SSXFF AM
    NLS_TIME_TZ_FORMAT HH.MI.SSXFF AM TZH:TZM
    NLS_TIMESTAMP_TZ_FORMAT DD-MON-RR HH.MI.SSXFF AM TZH:TZM
    NLS_DUAL_CURRENCY $
    NLS_COMP BINARY
    NLS_NCHAR_CHARACTERSET UTF8
    NLS_RDBMS_VERSION 8.1.7.4.1

    Thanks for your repley. I don't think I need to change NLS_CHARACTERSET setup because I can load Chinese data into the database and also can see the data by running Chinese tool like NJStar Communicator. Therefore, I probably need to change the session level parameters, but not sure.

  • How to view full script in sql*plus

    Hi,
    i am having a user who want to view the script for trigger by querying user_triggers in SQL*PLUS. i just remembered that there is some DBMS_ package for doing this. can anyone please provide that package name.
    thanks in advance

    Were you thinking of DBMS_METADATA?
    Have a look at this: http://blogs.ittoolbox.com/database/solutions/archives/ddl-generationoracles-answer-to-save-you-time-and-money-7590

  • View clob data is sql

    i have a column name "Description" with clob datatype.
    In one of the records, the 'description' has 5mb of text data.
    Is there a way to display the whole 5mb of data.
    Thanks in advance,
    Regards

    If you are using PL/SQL Developer its very easy to see the CLOB oblects just clicking ... button infront of that column .
    OR
    If you are using SQL*PLUS
    SET LONG 10000 -- to the size u want
    select col_clob from test
    Else
    set the offset LOBOFFSET from where u want to see the out put, 1 will give u the out put from begining
    SET LOBOFFSET 1
    Select col_clob from test

  • Viewing CLOB data in sql developer

    In SQL Developer 1.1, if CLOB data was returned from a query, you could place your mouse over the column and get most of it.
    But in 1.2, all you get is "(CLOB) <some data> ...", and nothing else. Is there something I need to set?

    You should look in the SQL Developer forum. I think your question is answered here:
    How to view the entire CLOB in results table?
    Regards Nigel

  • XML display in SQL*Plus

    Hi,
    I have a data stored in table in XML format in a clob column. When I query the table containing the XML data only part of the XML is shown in SQL*Plus. Is there anyway that I can view the full XML data in SQL* Plus prompt?
    Thanks,
    Milton.

    The SET LOBOFFSET, SET LONG and SET LONGCHUNKSIZE values affect how SQL*Plus fetches from CLOBs.
    See http://otn.oracle.com/docs/products/oracle9i/doc_library/release2/server.920/a90842/ch13.htm#1012674
    -- CJ

  • SQL*Plus formatting

    Can someone know how to configure login.sql to view data from SQL*Plus just like in standard MySQL output?

    as to the one column per line, I would recommend increasing your LINESIZE
    set linesize 1000
    to get the vertical bar between things
    set colsep |
    to force a row of underscores between each line
    set recsep each
    don't think we can do the "+"
    and I hope the lack of spaces (positional output) is due to the lack of "[ pre ]" tags in your post
    SQL> select * from words where rownum < 10;
    WORD                                                                   A N UPPER_WORD                             SEQ_NUM SOUN
    ARCADIAN                                                                   ARCADIAN                                     1 A623
    ARCHAEOLOGICAL                                                             ARCHAEOLOGICAL                               2 A624
    ARCHAEOLOGISTS                                                             ARCHAEOLOGISTS                               3 A624
    ARISTOTELIANS                                                              ARISTOTELIANS                                4 A623
    ARITA                                                                      ARITA                                        5 A630
    ARIZONA                                                                    ARIZONA                                      6 A625
    ARJUNA                                                                     ARJUNA                                       7 A625
    ARKANSAS                                                                   ARKANSAS                                     8 A625
    ARKWRIGHT                                                                  ARKWRIGHT                                    9 A626
    SQL>
    SQL>
    SQL> set linesize 1000
    SQL> set colsep |
    SQL> set recsep each
    SQL> /
    WORD                                                                  |A|N|UPPER_WORD                         |   SEQ_NUM|SOUN
    ----------------------------------------------------------------------|-|-|-----------------------------------|----------|----
    ARCADIAN                                                              | | |ARCADIAN                           |         1|A623
    ARCHAEOLOGICAL                                                        | | |ARCHAEOLOGICAL                     |         2|A624
    ARCHAEOLOGISTS                                                        | | |ARCHAEOLOGISTS                     |         3|A624
    ARISTOTELIANS                                                         | | |ARISTOTELIANS                      |         4|A623
    ARITA                                                                 | | |ARITA                              |         5|A630
    ARIZONA                                                               | | |ARIZONA                            |         6|A625
    ARJUNA                                                                | | |ARJUNA                             |         7|A625
    ARKANSAS                                                              | | |ARKANSAS                           |         8|A625
    ARKWRIGHT                                                             | | |ARKWRIGHT                          |         9|A626
    ------------------------------------------------------------------------------------------------------------------------------------

  • SQL*Plus vs web/browser admin interface for 10g Express

    hello, I'm a newbie in Oracle. Seem like I executed the setup script using SQL*Plus successfully (the scrpt CREATE TABLE then INSERT setup data) but seems like Oracle 10g Express web/browser interface tells me the setup data has never been inserted into the tables created?!
    SQL*Plus: Release 10.2.0.1.0 - Production on Mon Apr 6 14:10:05 2009
    +                         Copyright (c) 1982, 2005, Oracle. All rights reserved.+
    +                         SQL> connect dev/dev+
    +                         Connected.+
    +                         SQL> set serveroutput on+
    +                         SQL> @C:\dev\...sql\Oracle\SetupSchema\setup.oracle.tables.sql+
    +                         1125 /+
    +                         PL/SQL procedure successfully completed.+
    I verified this from SQL*Plus environmet:
    SQL> select count(1) from GenericCombolistItem
    +2 /+
    COUNT(1)
    +506+
    I then closed SQL*Plus and tried to browse via :
    http://127.0.0.1:8081/apex/f?p=4500:1003:480765345738397::NO:1003::
    (Start>All Programs>Oracle Database 10g Express Edition>Go to Database Home Page)
    I ran the count(1) SQL again just to check. The table is empty?! I logged into SQL*Plus AND 10g web interface using same credential dev/dev. Not sure what's happening why I can see data from SQL*Plus but not web/browser admin interface

    GOT IT! --- I needed COMMIT

  • ORA-01401 on execution SQL*Plus Copy command

    I looking solution for strange problem :
    I having two database created with AL32UTF8 character-set ; current application design are that we loading data throw SQL Loader and than transferring loaded data from one database to another using SQL*Plus copy command.
    Now , we having two tables , declared 100% identically , with respect to NLS and CHAR semantics (all varchar fields having CHAR inside length).
    At attempt to transfer data , with SQL*Plus Copy command I'm receiving next output :
    ERROR:
    ORA-01401: inserted value too large for column
    If I'm trying to transfer data via DB link , and this succeeds , or throw exp/imp utilities it also works .
    Database servers are 9.2 (i tryied with 9.2.0.6 or 9.2.0.8) ; client side were 9.2.0.8 , 10.1.0.5 ...
    On client side NLS_LANG variable are set to AMERICAN_AMERICA.AR8MSWIN1256 (we working on project who needs to support arabic language)
    Did anyone encountered same problem ? Any One ?

    it could be that the column of the table that you are trying to insert the data has a small length.

  • SQL*PLUS 에서 ONLINE HELP 기능

    제품 : SQL*PLUS
    작성날짜 : 1999-10-08
    SQL*PLUS Help
    =============
    SQL*PLUS 에서 Online Help 기능을 제공하여 굳이 SQL Reference 를 참조하지
    않아도 Online 상에서 확인이 가능하다.
    그런데 간혹 help 에 문제가 생기는 경우 다음과 같이 새로 생성하면 된다.
    1. help 디렉토리로 이동한다.
    % cd $ORACLE_HOME/sqlplus/admin/help
    2. SYSTEM user 로 SQL*Plus 에 Login 한다.
    % sqlplus system/<password>
    3. 해당 디렉토리의 "helptbl.sql" script 를 수행한다.
    SQL> @helptbl
    해당 스크립트는 Help 라는 테이블을 생성하고 Public 으로 지정한다.
    4. SQL*Loader 로 필요한 Record 를 Help 테이블에 로딩한다..
    % sqlldr system/manager control=plushelp.ctl
    % sqlldr system/manager control=sqlhelp.ctl
    % sqlldr system/manager control=plshelp.ctl
    5. SYSTEM user 로 SQL*Plus 에 Login 한다.
    "helpindx.sql" script 를 수행한다.
    SQL> @helpindx
    해당 스크립트는 필요한 각종 view 와 index 를 생성한다.
    // 위의 사항은 Unix 계열의 SQL*PLUS 에서 적용이 되는 내용이다
    Windows 95/98/NT 에서는 현재 On-line Help 가 지원되지 않는다.
    다만 Oracle install CD 에서 Oracle Online Documentation 을 인스톨 한
    후 Adobe Acrobat runtime 으로 보아야 한다.
    DB SERVER 8.1.6 이상에서는
    SQLPLUS에서 사용되는 help 기능만 제공됩니다.
    8.1.6 이상에서 help를 생성하기 위해서는
    % cd $ORACLE_HOME/sqlplus/admin/help
    % sqlplus system/<password>
    SQLPLUS>helpbld.sql
    SQLPLUS>helpus.sql

    I personally don't like SQL Developer or TOAD, though perhaps I'm in a minority. I agree completely. Toad does a lot of things but many of are ill thought out, the most obvious is the default feature of displaying a result time after fetching the first screen of rows. This alone has led to hundreds of posting along the lines of, I have this query that returns 12 billion rows. In a stored procedure it takes days, but it completes in 12 milliseconds in TOAD?
    The last I looked SQL Developer had that typical Java sluggishness on a Windows box, and I am still not interested in whether that is a Windows or Java problem. I just know that if I have to use Windows I tend to choose applications that are not written in Java if possible.
    It also was unable to connect using OS authenticated accounts which effectively ruled it out as anything other than a toy as our development environment mandates it. I believe there may be a workaround, but there are always hints of waving a rubber chicken at it and frankly why bother at this stage.
    PL/SQL Developer is by far the best.

  • Sporadically getting error "string or binary data would be truncated" in SQL server 2008 while inserting in a Table Type object

    I am facing a strange SQL exception:-
    The code flow is like this:
    .Net 4.0 --> Entity Framework --> SQL 2008 ( StoredProc --> Function {Exception})
    In the SQL Table-Valued Function, I am selecting a column (nvarchar(50)) from an existing table and (after some filtration using inner joins and where clauses) inserting the values in a Table Type Object having a column (nvarchar(50))
    This flow was working fine in SQL 2008 but now all of sudden the Insert into @TableType is throwing  "string or binary data would be truncated"  exception. 
    Insert Into @ObjTableType
    Select * From dbo.Table
    The max length of data in the source column is 24 but even then the insert statement into nvarchar temp column is failing.
    Moreover, the same issue started coming up few weeks back and I was unable to find the root cause, but back then it started working properly after few hours
    (issue reported at 10 AM EST and was automatically resolved post 8 PM EST). No refresh activity was performed on the database.
    This time however the issue is still coming up (even after 2 days) but is not coming up in every scenario. The data set, for which the error is thrown, is valid and every value in the function is fetched from existing tables. 
    Due to its sporadic nature, I am unable to recreate it now :( , but still unable to determine why it started coming up or how can i prevent such things to happen again.
    It is difficult to even explain the weirdness of this bug but any help or guidance in finding the root cause will be very helpful.
    I also Tried by using nvarchar(max) in the table type object but it didn't work.
    Here is a code similar to the function which I am using:
    BEGIN
    TRAN
    DECLARE @PID
    int = 483
    DECLARE @retExcludables
    TABLE
        PID
    int NOT
    NULL,
        ENumber
    nvarchar(50)
    NOT NULL,
        CNumber
    nvarchar(50)
    NOT NULL,
        AId
    uniqueidentifier NOT
    NULL
    declare @PSCount int;
    select @PSCount =
    count('x')
    from tblProjSur ps
    where ps.PID
    = @PID;
    if (@PSCount = 0)
    begin
    return;
    end;
    declare @ExcludableTempValue table (
            PID
    int,
            ENumber
    nvarchar(max),
            CNumber
    nvarchar(max),
            AId
    uniqueidentifier,
            SIds
    int,
            SCSymb
    nvarchar(10),
            SurCSymb
    nvarchar(10)
    with SurCSymbs as (
    select ps.PID,
                   ps.SIds,              
                   csl.CSymb
    from tblProjSur ps
                right
    outer join tblProjSurCSymb pscs
    on pscs.tblProjSurId
    = ps.tblProjSurId
    inner join CSymbLookup csl
    on csl.CSymbId
    = pscs.CSymbId 
    where ps.PID
    = @PID
        AssignedValues
    as (
    select psr.PID,
                   psr.ENumber,
                   psr.CNumber,
                   psmd.MetaDataValue
    as ClaimSymbol,
                   psau.UserId
    as AId,
                   psus.SIds
    from PSRow psr
    inner join PSMetadata psmd
    on psmd.PSRowId
    = psr.SampleRowId
    inner join MetaDataLookup mdl
    on mdl.MetaDataId
    = psmd.MetaDataId
    inner join PSAUser psau
    on psau.PSRowId
    = psr.SampleRowId
                inner
    join PSUserSur psus
    on psus.SampleAssignedUserId
    = psau.ProjectSampleUserId
    where psr.PID
    = @PID
    and mdl.MetaDataCommonName
    = 'CorrectValue'
    and psus.SIds
    in (select
    distinct SIds from SurCSymbs)         
        FullDetails
    as (
    select asurv.PID,
    Convert(NVarchar(50),asurv.ENumber)
    as ENumber,
    Convert(NVarchar(50),asurv.CNumber)
    as CNumber,
                   asurv.AId,
                   asurv.SIds,
                   asurv.CSymb
    as SCSymb,
                   scs.CSymb
    as SurCSymb
    from AssignedValues asurv
    left outer
    join SurCSymbs scs
    on    scs.PID
    = asurv.PID
    and scs.SIds
    = asurv.SIds
    and scs.CSymb
    = asurv.CSymb
    --Error is thrown at this statement
    insert into @ExcludableTempValue
    select *
    from FullDetails;
    with SurHavingSym as (   
    select distinct est.PID,
                            est.ENumber,
                            est.CNumber,
                            est.AId
    from @ExcludableTempValue est
    where est.SurCSymb
    is not
    null
    delete @ExcludableTempValue
    from @ExcludableTempValue est
    inner join SurHavingSym shs
    on    shs.PID
    = est.PID
    and shs.ENumber
    = est.ENumber
    and shs.CNumber
    = est.CNumber
    and shs.AId
    = est.AId;
    insert @retExcludables(PID, ENumber, CNumber, AId)
    select distinct est.PID,
    Convert(nvarchar(50),est.ENumber)
    ENumber,
    Convert(nvarchar(50),est.CNumber)
    CNumber,
                            est.AId      
    from @ExcludableTempValue est 
    RETURN
    ROLLBACK
    TRAN
    I have tried by converting the columns and also validated the input data set for any white spaces or special characters.
    For the same input data, it was working fine till yesterday but suddenly it started throwing the exception.

    Remember, the CTE isn't executing the SQL exactly in the order you read it as a human (don't get too picky about that statement, it's at least partly true enough to say it's partly true), nor are the line numbers or error messages easy to read: a mismatch
    in any of the joins along the way leading up to your insert could be the cause too.  I would suggest posting the table definition/DDL for:
    - PSMetadata, in particular PSRowID, but just post it all
    - tblProjectSur, in particularcolumns CSymbID and TblProjSurSurID
    - cSymbLookup, in particular column CSymbID
    - PSRow, in particular columns SampleRowID, PID,
    - PSAuser and PSUserSur, in particualr all the USERID and RowID columns
    - SurCSymbs, in particular colum SIDs
    Also, a diagnostic query along these lines, repeat for each of your tables, each of the columns used in joins leading up to your insert:
    Select count(asurv.sid) as count all
    , count(case when asurv.sid between 0 and 9999999999 then 1 else null end) as ctIsaNumber
    from SurvCsymb
    The sporadic nature would imply that the optimizer usually chooses one path to the data, but sometimes others, and the fact that it occurs during the insert could be irrelevant, any of the preceding joins could be the cause, not the data targeted to be inserted.

Maybe you are looking for