Skip to content
Advertisement

Set Db2 statement terminator using C#

I want to create stored procedures in Db2 using C#.

My script looks something like this:

create procedure test 
P1: begin 
statement1;
statement2;
statement3;
end P1ß

To execute the procedures, I use the DB2Command.ExeCuteNonQuery() function.

The problem is that ; is used as a terminator, but I need a custom terminator. Attempting to set the terminator with --#SET TERMINATOR ß is only recognized as a comment.

Is there another way to set the terminator?

Advertisement

Answer

You don’t need a custom terminator. Since you can only issue a single statement at a time using the OLE DB interface, the entire string you send is treated as a statement (in your case — create procedure test ... end p1), and the presence of ;s inside it does not matter.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement