ORA-01722: invalid number Error occurred When using DTS

  • Hi All;

    I'd like to copy a part of records in Oracle DB to SQL Server 2000 with DTS.

    DTS's Steps are...

    1. Run Execute SQL Task to retrieve the data and output to GV with RecrodSet Type.

    SELECT col1 FROM TableA --> Lists (RecordSet)

    !! some records are return as result !!

    2. Run ActiveX Script Task to change data type from RecordSet to String and output to GV with Lists_for_Query.

    set objRS = CreateObject("ADODB.Recordset")

    set objRS = DTSGlobalVariables("Lists").value

    for cnt = 1 to objRS.RecordCount

    if strList = "" then

    strList = objRS.Fields("col1").value

    else

    strList = strList & ", " & objRS.Fields("col1").value

    end if

    objRS.MoveNext

    next

    DTSGlobalVariables("Lists_of_Query").value = strList

    Lists_of_Query contains a string such as "1200, 1201, 2003"

    3. Run Transform Data Task to copy a part of records in Oracle DB to SQL Server 2000 with following Query.

    SELECT *

    FROM TableB

    WHERE (col2 IN (?) )

    !! The type of col2 is Number(10) !!

    When I run this DTS, I got "ORA-01722: invalid number" Error Message.

    But I can run the following query in Oracle SQL Developer Toole.

    SELECT *

    FROM TableB

    WHERE (col2 IN (1200, 1201, 2003) )

    Do you have any idea?

  • where does the come from?

  • Sorry. TableA is held by MSSQL Server. TableB is held by Oracle 10g.

  • I'm not familiar with DTS nor the "b" parameters.

    I suspect that strList is passed as a string instead of a rowset/table. (for the in clause)

    Like in ('abc,ddfdfqd,dfdfqdfe')

    You can resort to dynamic sql using sp_executesql (beware of sql-injection)

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply