Skip to main content
Solved

SQLExecutor issue

  • September 4, 2019
  • 5 replies
  • 174 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.

View original
Did this help you find an answer to your question?

5 replies

erik_jan
Contributor
Forum|alt.badge.img+18
  • Contributor
  • 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
  • September 4, 2019
erik_jan wrote:

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
  • 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
  • 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
  • September 5, 2019
david_r wrote:

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. 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings