简体   繁体   中英

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM