Focal Point Banner
Community Center Education Summit Technical Support User Groups
Let's Get Social!

Facebook Twitter LinkedIn YouTube
Focal Point    Focal Point Forums  Hop To Forum Categories  iWay Software Product Forum on Focal Point    SQL Object - insert statement
Go
New
Search
Notify
Tools
Reply
  
SQL Object - insert statement
 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: 22 | Registered: January 15, 2008Reply With QuoteReport This Post
Guru
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.5
AND WebLogic server as web server
sql2005 as database server
 
Posts: 273 | Location: Europe | Registered: May 31, 2007Reply With QuoteReport 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: 22 | Registered: January 15, 2008Reply With QuoteReport This Post
<nklamen>
posted
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).
 
Reply With QuoteReport This Post
Member
posted Hide Post
Thanks. It works.


iWay adapter manager
SAP Adapter
Web Services
SAP BASIS, Java Core
 
Posts: 22 | Registered: January 15, 2008Reply With QuoteReport This Post
Platinum Member
posted Hide Post
I'm using this syntax:

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

But, if I have a numeric variable that I want to store in a numeric field and I put quote marks around it I get the following error message:

FOC1414) EXECUTE IMMEDIATE ERROR.(FOC1400) SQLCODE IS 8114 (HEX: 00001FB2) XOPEN: 22018: Microsoft OLE DB Provider for SQL Server: [22018] Error converting data: type varchar to numeric.

If I leaave the quote marks out, I get this error messaage:

: Microsoft OLE DB Provider for SQL Server: [42000] The name "SRS_CRTFC_PC: " is not permitted in this context. Valid expressions are constants, con: stant expressions, and (in some contexts) variables. Column names are no: t permitted.

So, what do I do?


7.7.02
Windows
EXCEL, PDF, CSV, TEXT
 
Posts: 106 | Registered: June 25, 2009Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  iWay Software Product Forum on Focal Point    SQL Object - insert statement

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