Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

ORA-01722: invalid number Error occurred When using DTS Expand / Collapse
Author
Message
Posted Tuesday, March 17, 2009 12:49 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, March 10, 2011 11:54 PM
Points: 2, Visits: 17
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?
Post #677219
Posted Tuesday, March 17, 2009 7:41 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Today @ 6:22 AM
Points: 1,356, Visits: 5,667
where does the come from?
Post #677432
Posted Wednesday, March 18, 2009 12:47 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, March 10, 2011 11:54 PM
Points: 2, Visits: 17
Sorry. TableA is held by MSSQL Server. TableB is held by Oracle 10g.
Post #678149
Posted Wednesday, March 18, 2009 1:41 PM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Today @ 6:22 AM
Points: 1,356, Visits: 5,667
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)
Post #678860
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse