Skip to main content
Solved

SQLExecutor issue

  • September 4, 2019
  • 5 replies
  • 209 views

Forum|alt.badge.img

I am trying to use SQLExecutor to either insert or update a record in a table stored in Oracle - please see sql below. It gave me the following error. any ideas why?

 

declare

counts int;

begin

select count(*) into counts FROM employee where emp_id = '@Value(empid)';

case

when counts = 0 then INSERT INTO employee VALUES ('@Value(empid)','@Value(firstname)');

when counts = 1 then UPDATE employee SET firstname = '@Value(firstname)' WHERE emp_id = '@Value(empid)';

end case;

end;

 

An error occurred while accessing a table result for feature type `'; message was `Execution of statement '

......

did not succeed; error was `ORA-06550: line 7, column 14:

PL/SQL: ORA-00933: SQL command not properly ended

ORA-06550: line 6, column 30:

PL/SQL: SQL Statement ignored

ORA-06550: line 9, column 4:

PLS-00103: Encountered the symbol ";" when expecting one of the following:

Best answer by david_r

Was this error raised for the first feature, or during further processing?

Could it be hat you have a value of firstname that contains a single quotation mark or some other character that could interfere with the SQL statement?

You can also try putting the following at the very top (do NOT use ; for the delimiter in this case):

FME_SQL_DELIMITER #

This will ensure that FME doesn't try to split up the SQL statement before sending it to Oracle.

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

5 replies

erik_jan
Contributor
Forum|alt.badge.img+22
  • Contributor
  • 2179 replies
  • September 4, 2019

I believe you will need to add this at the top of your window:

FME_SQL_DELIMITER ;


Forum|alt.badge.img
  • Author
  • 15 replies
  • September 4, 2019

I believe you will need to add this at the top of your window:

FME_SQL_DELIMITER ;

thanks for your reply. now it threw "did not succeed; error was `ORA-00900: invalid SQL statement'. "


david_r
Celebrity
  • 8394 replies
  • Best Answer
  • September 5, 2019

Was this error raised for the first feature, or during further processing?

Could it be hat you have a value of firstname that contains a single quotation mark or some other character that could interfere with the SQL statement?

You can also try putting the following at the very top (do NOT use ; for the delimiter in this case):

FME_SQL_DELIMITER #

This will ensure that FME doesn't try to split up the SQL statement before sending it to Oracle.


gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • 2252 replies
  • September 5, 2019

@wgsl2005

 

I think your syntaxis is off.

The ";" between the "when" should go and insert a "else"

Or add a "case" before the second "when" if the delimiter signifies a new sql snippet.

 

Row starting with just "when" seems not valid.

https://docs.oracle.com/cd/B19306_01/server.102/b14200/expressions004.htm


Forum|alt.badge.img
  • Author
  • 15 replies
  • September 5, 2019

Was this error raised for the first feature, or during further processing?

Could it be hat you have a value of firstname that contains a single quotation mark or some other character that could interfere with the SQL statement?

You can also try putting the following at the very top (do NOT use ; for the delimiter in this case):

FME_SQL_DELIMITER #

This will ensure that FME doesn't try to split up the SQL statement before sending it to Oracle.

Thank You So Much! i have debugged for a few hours for frustration and your solution worked.

so the solution is to add FME_SQL_DELIMITER #  on the top. the SQL statements are correct.