IB - Developer Center    Forums  Hop To Forum Categories  iWay Products    SQL Object - insert statement
Go
New
Search
Notify
Tools
Reply
  
-star Rating Rate It!  Login/Join 
Member
Posted
Hi All,

I created a SQL Object via Adapter Designer. It's used to insert a record into a table (for instance table1).

I put the following sql statement into statement tab.
INSERT INTO table1 (A,B) VALUES(?ValueA,?ValueB)

I definded two 'User defined properties'
ValueA - the value is string (for instance a)
ValueB - the value is a string (for instance b)

When I ran the sql object. I got "ORA-00917: missing comma" error.

The runtime sql statement is "INSERT INTO table1(A,B) VALUES(a,b)". It's not correct. The "a" and "b" should be put into a pair of single quote.

I tried _CONCAT("\'",a,"\'") and _CONCAT("\'",b,"\'") they dont work.

I am wondering if someone encountered the same problem before.

Thanks,


iWay adapter manager
SAP Adapter
Web Services
SAP BASIS, Java Core
 
Posts: 10 | Registered: January 15, 2008Reply With QuoteEdit or Delete MessageReport This Post
Platinum Member
Posted Hide Post
Hi,

If your table contains more fields than A and B, you may need to add them with null values in the insert statement.

Majid.


WebFocus 7.6.2
AND WebLogic server as web server
sql2005 as database server
 
Posts: 161 | Location: Europe | Registered: May 31, 2007Reply With QuoteEdit or Delete MessageReport This Post
Member
Posted Hide Post
Maybe I didn't make myself cleary.

The problem is in the statement tab of SQL Object. The sql statment is "insert into table1(a,b) values(?ValueA,?ValueB)"

During runtime, after it gets the values. The sql statement looks like:

INSERT INTO table1 values(A,B).

which is not a valid statement. it should be:

INSERT INTO table1(a,b) values('A','B')

I am wondering if anybody knows how to put the pair of single quotes in.

thanks,
Dennis


iWay adapter manager
SAP Adapter
Web Services
SAP BASIS, Java Core
 
Posts: 10 | Registered: January 15, 2008Reply With QuoteEdit or Delete MessageReport This Post
Member
Posted Hide Post
Instead of:



INSERT INTO table1 (A, B) VALUES( ?ValueA, ?ValueB )



Code the statement as:



INSERT INTO table1 (A, B) VALUES(‘?ValueA’, ‘?ValueB’)



…making the single quotes part of the statement prior to parameter substitution. This approach should always work because the type (char vs. numeric.) is a known, fixed attribute of each target column. Obviously the single quotes should be omitted around parameters which do not need to be quoted at execution (those inserted into numeric columns).
 
Posts: 3 | Registered: November 20, 2007Reply With QuoteEdit or Delete MessageReport This Post
Member
Posted Hide Post
Thanks. It works.


iWay adapter manager
SAP Adapter
Web Services
SAP BASIS, Java Core
 
Posts: 10 | Registered: January 15, 2008Reply With QuoteEdit or Delete MessageReport This Post
 Previous Topic | Next Topic powered by eve community  
 

IB - Developer Center    Forums  Hop To Forum Categories  iWay Products    SQL Object - insert statement

Copyright © 1996-2008 Information Builders, leaders in enterprise business intelligence.