Insert SQL with variable / parameter giving error in ExecuteNonQuery activity

Hello folks,

Need help - I’m using ExecuteNonQuery activity and trying to insert data into DB. But, getting error while using it with either variable/ parameter.

“insert into O2CINTF.ZBR_AUTO_SO_LINE_UPD (ROW_ID, SO_NUM, ORD_REV_NUM, ORACLE_LINE_NUM, UOM, SHIPPING_METHOD, SHIPPING_ADDR, IMPORT_DATE, STATUS, ERR_FLAG, ERR_MSG1, ORG)
values (” + @sqlSOLIRowId + “, ‘11204715’, ‘2’, ‘1.1’, ‘’, ‘Express’, ‘1-14V7J-2891’, sysdate, ‘TEST_UPDATE’, ‘’, ‘’, ‘1-9GDC’)”

Comilation error: String constant must end with double quote

If I remove the double quotes then missing expression error comes up:

“insert into O2CINTF.ZBR_AUTO_SO_LINE_UPD (ROW_ID, SO_NUM, ORD_REV_NUM, ORACLE_LINE_NUM, UOM, SHIPPING_METHOD, SHIPPING_ADDR, IMPORT_DATE, STATUS, ERR_FLAG, ERR_MSG1, ORG)
values (@sqlSOLIRowId, ‘11204715’, ‘2’, ‘1.1’, ‘’, ‘Express’, ‘1-14V7J-2891’, sysdate, ‘TEST_UPDATE’, ‘’, ‘’, ‘1-9GDC’)”

18.4.1+Branch.master.Sha.bc66386dd8e2160b6d35f31d5ce934a5aa4cf4bd
Source: Execute Non Query
Message: ERROR [HY000] [Oracle][ODBC][Ora]ORA-00936: missing expression

Other details:
Studio 2018.4.1 - 12/10/2018 Enterprise Edition
Microsoft Windows 10 Enterprise 64-bit
.NET Framework Version 4.7.2

Please help!

Hi @ramawat

Try to put this ExecuteNonQuery inside a for each activity.

Cheers,
Pablo

Hey @Pablo_Sanchez,

Thanks for the revert. I’m just designing this flow. If it works for one default value passed through variable, I can make dynamic using for-each activity.

On the flip side, any reason how using for-each activity would help to sort out this syntactical issue?

Hi again @ramawat

I can’t tell you 100% the reason of use the NonQuery inside a foreach, because when you make a Execute query, you dont need to do it through for each…

I just had the same problem as you, and I solved it using the for each
image

Maybe some user can give us a cool explanation :slight_smile: @ClaytonM @balupad14 ^^ :slight_smile:

Cheers,
Pablo

Hello @Pablo_Sanchez,

Thanks for your screenshot. Could you please share/ paste the part of your procedure/ SQL where the variable or parameters are being passed in the EditQuery property.

Cheers !!

Sure @ramawat

The Query is the next:

“INSERT Into XXXXXXXX.[XXX].[XXX_XXX_XXX]
([SUC]
,[IPID]
,[Central]
,[Tipo de Registro]
,[Fecha solicitud]
,[Solicitud A]
,[IPID-Central]
,[IPID-Central-SUC])
VALUES
(@SUC
,@IPID
,@Central
,@TipoReg
,@FechaSolicitud
,@Solicitud_A
,@IPID_Central
,@IPID_Central_SUC)”

Cheers,
Pablo

1 Like

Appreciate your help @Pablo_Sanchez, but it didn’t work, since the inherent SQL expression has the problem with parameter/ variable. Hope I can get some attention by other RPA gurus (@vvaidya @ovi @balupad14) out there :smiley:

Hi @ramawat,
I made a test what @Pablo_Sanchez mentioned with a little table. It is working fine. can you attache the table script and your insert query as a zip file. May be it helps to do the analysis.
But any way, Here I have attached xaml and table for your reference.

SqlServer.zip (2.7 KB)

Regards
Balamurugan.S

Hi @Pablo_Sanchez, Great work… :clap::clap::clap::clap::clap::clap::clap:

Regards
Balamurugan.S

@balupad14 Thanks for the file. I’m trying the same but wierdly UiPath isn’t resolving it for me. Enclosed my XAML for your pursual. ODBCCallSiebelStagingTable.xaml (12.4 KB)
Please let me know, if you know if you see any discrepancy. Thanks.

@balupad14: Could you please help with the enclosed file in pointing out the issue here?

@badita @aksh1yadav @akhi_s27 @Vikas.Jain @Vitan @beesheep - could you please help me, as I’m not getting any way forward. Thank you !

Hi @ramawat,

When I opened your xaml. It is some thing missing the below arrow point.

image

Can you try like this.

image

Regards
Balamurugan.S

@balupad14: I realized that missing parameter, but it didn’t help. So, I chose an alternate way to resolve it.

Alternative summary for community’s benefit: I explicitly invoked connect activity with data source and then passed the SQL through a variable into Non Execute Query activity step. This eventually worked for me !

2 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.