SQL Statement Issue

SQL Statement Issue

rajivlcr的头像

Hi,
I have included SQL statement in my project and also created JDBC resource.

When I use this styatement,
INSERT INTO XXX_TRACE VALUES('15244194326c8255fcdcc5334611','','','financeServiceProxy')

Its successfully inserting in to DB.

But I need to replace 'financeproxy' with XML elements.

SO i tried this,

INSERT INTO XXX_TRACE VALUES('15244194326c8255fcdcc5334611','','',GetUserName.body/ldap:batchResponse/ldap:searchResponse/ldap:searchResultEntry/@dn)

But its giving me SYntax error.

Do i miss quotes here? How to form valid statement?

I have tried using single quotes. But no use.

10 帖子 / 0 new
最新文章
如需更全面地了解编译器优化,请参阅优化注意事项
Vikrant Pawar的头像

Hi, Could you send exact error you are getting as SQL statment looks good. ~ Vikrant

rajivlcr的头像

WfpWorkflow(Name[AirScheduleService_AirScheduleEndpointPort_getDirectServiceDi001],
TargetNamespace[http://www.example.com/LDAPAuth/bpel/LDAPAuth/AirScheduleService_AirSche...,
Location[../app/LDAPAuth/AirScheduleService_AirScheduleEndpointPort_getDirectServiceDi001.bpel],
Id[300030109], StatsId[3-0]): Failed Workflow Compilation: BPEL compiler errors
in file
"../app/LDAPAuth/AirScheduleService_AirScheduleEndpointPort_getDirectServiceDi001.bpel".
expression "INSERT INTO MESSAGE_TRACE
VALUES('15244194326c8255fcdcc5334611','','','financeServiceProxy','http://wsm.hp.com/finance','','getQuote','FinanceServiceSoap','','',$GetUserName.body/ldap:batchResponse/ldap:searchResponse/ldap:searchResultEntry/@dn,'','127.0.0.1','',10,'','none',368,484,'','','','','',1)",
[file=../app/LDAPAuth/AirScheduleService_AirScheduleEndpointPort_getDirectServiceDi001.bpel,
line=1684,
path=/bpws:process[1]/bpws:sequence[1]/bpws:extensionActivity[8]/soae-ab:SQLStatement[1]/bpws:scope[1]/bpws:sequence[1]/bpws:assign[1]/bpws:copy[2]/bpws:from[1],
name=SQLStatement]: Syntax error in expression, INSERT INTO MESSAGE_TRACE
VALUES('15244194326c8255fcdcc5334611','','','financeServiceProxy','http://wsm.hp.com/finance','','getQuote','FinanceServiceSoap','','',$GetUserName.body/ldap:batchResponse/ldap:searchResponse/ldap:searchResultEntry/@dn,'','127.0.0.1','',10,'','none',368,484,'','','','','',1)
[position 6] - :0

rajivlcr的头像

Hi Vikrant,
DO I need to pass any SQL parameters?

Vikrant Pawar的头像

That's not necessary, It looks like variable value is not going throguh, Could you attach your application, It looks mismtach over there. ~Vikrant

rajivlcr的头像

Hi Vikrant,
Have you received my bundle?

Vikrant Pawar的头像

Ya I got bundle, Let me try that, Will update you on same ~ Vikrant

Sergey Kostrov的头像
Hi,

Quoting rajivlcr ...
INSERT INTO XXX_TRACE VALUES('15244194326c8255fcdcc5334611','','',GetUserName.body/ldap:batchResponse/ldap:searchResponse/ldap:searchResultEntry/@dn)

But its giving me SYntax error.

Do i miss quotes here? How to form valid statement?

I have tried using single quotes. But no use.

Could you provide some details for the table 'XXX_TRACE'?

The table was created in your database with some 'CREATE TABLE ...' SQL-statement. So, it would be nice to see
thatSQL-statement ( types for these 4columns, ALL constraints,etc ).

Best regards,
Sergey

Sergey Kostrov的头像

Please use the following SQL-script to reproduce the error:

USE master
GO
IF EXISTS ( SELECT * FROM master..sysdatabases WHERE name='TestDb' )
DROP DATABASE TestDb
GO
PRINT 'TestDb database is deleted successfully'
GO

SET TRANSACTION ISOLATION LEVEL read uncommitted
GO
SET NOCOUNT OFF
GO

CREATE DATABASE TestDb
GO
USE TestDb
GO
PRINT 'TestDb database is created successfully'
GO

CREATE TABLE TestTable
(
TTID INT IDENTITY (1,1) NOT NULL,
TTFIELD1 VARCHAR NULL,
TTFIELD2 VARCHAR(24) NULL,
TTFIELD3 CHAR(24) NULL
)
GO

--SELECT * FROM TestTable

--BEGIN TRANSACTION

-- Test1 - No Error: (1 row(s) affected)
INSERT INTO TestTable
( TTFIELD1, TTFIELD2, TTFIELD3 )
VALUES
( '0', '012345678901234567890123', '012345678901234567890123' )

-- Test2 - Error:
-- Server: Msg 8152, Level 16, State 14, Line 2
-- String or binary data would be truncated.
-- The statement has been terminated.
INSERT INTO TestTable
( TTFIELD1, TTFIELD2, TTFIELD3 )
VALUES
( '01', '012345678901234567890123', '012345678901234567890123' )

-- Test3 - Error:
-- Server: Msg 8152, Level 16, State 14, Line 2
-- String or binary data would be truncated.
-- The statement has been terminated.
INSERT INTO TestTable
( TTFIELD1, TTFIELD2, TTFIELD3 )
VALUES
( '0', '0123456789012345678901234', '012345678901234567890123' )

-- Test4 - Error:
-- Server: Msg 8152, Level 16, State 14, Line 2
-- String or binary data would be truncated.
-- The statement has been terminated.
INSERT INTO TestTable
( TTFIELD1, TTFIELD2, TTFIELD3 )
VALUES
( '0', '012345678901234567890123', '0123456789012345678901234' )

--COMMIT
--ROLLBACK

Sergey Kostrov的头像
Quoting rajivlcr Do i miss quotes here? How to form valid statement?

I have tried using single quotes. But no use.

Hi everybody,
This is a follow up: Are there any news / updates?
Best regards,
Sergey

登陆并发表评论。