Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: 2 transactions
A copy of this was sent to chuaby_at_hotmail.com (Chua Boon Yiang)
(if that email address didn't require changing)
On Wed, 07 Oct 1998 10:52:15 GMT, you wrote:
>Hi
>in Powerbuilder, i can define 2 transactions as eg : sqlca and sqlca1.
>Then
> select *
> from table1
> using sqlca or
>
> select *
> from table2
> using sqlca1
>
>then i can
> commit using sqlca1 or
> commit using sqlca2.
>
>May i know is there any equivalent in Pro C for oracle ?
>
>Thanks
>Boon Yiang
Yes there is. It would might like this:
main( argc, argv )
int argc;
char * argv[];
{
EXEC SQL BEGIN DECLARE SECTION;
VARCHAR oracleid[50];
int n;
EXEC SQL END DECLARE SECTION;
EXEC SQL DECLARE DB_1 DATABASE;
EXEC SQL DECLARE DB_2 DATABASE;
strcpy( oracleid.arr, "tkyte/tkyte" );
oracleid.len = strlen( oracleid.arr );
EXEC SQL WHENEVER SQLERROR DO sqlerror_hard();
EXEC SQL CONNECT :oracleid AT DB_1; EXEC SQL CONNECT :oracleid AT DB_2;
printf("\nConnected to ORACLE (twice) as user: %s\n\n", oracleid.arr);
EXEC SQL AT DB_1
INSERT INTO MCONNECT_TEST SELECT USER_ID FROM ALL_USERS;
EXEC SQL AT DB_2
INSERT INTO MCONNECT_TEST SELECT USER_ID FROM ALL_USERS;
EXEC SQL AT DB_1 COMMIT WORK; }
Thomas Kyte
tkyte_at_us.oracle.com
Oracle Government
Herndon VA
--
http://govt.us.oracle.com/ -- downloadable utilities
Anti-Anti Spam Msg: if you want an answer emailed to you, you have to make it easy to get email to you. Any bounced email will be treated the same way i treat SPAM-- I delete it. Received on Wed Oct 07 1998 - 06:34:32 CDT