Re: Syntax error in Pro*C

From: <roosens>
Date: 1996/07/31
Message-ID: <4tofqg$2amu_at_news-s01.ny.us.ibm.net>#1/1


ilg_at_elan.cc.bellcore.com (guthrie,ian) wrote:
>
>I am using Pro*C release 2.1.2.0.0, Oracle version 7.2.2 on Solaris 2.4.
>I have the following code segment:
>
>
> varchar rback[4];
> char *p;
>
> if (p=getenv("RBACK")) {
> strncpy((char *)rback.arr, p, 3);
> rback.arr[4] = '\0';
> rback.len = strlen((char *) rback.arr);
>
> EXEC SQL SET TRANSACTION USE ROLLBACK SEGMENT :rback;
>
> if (sqlca.sqlcode != 0) {
> printf("cannot set rollback segment %s\n", rback.arr);
> sql_error();
> }
>
> }
> else
> printf("Environment variable RBACK, not defined.\n");
>
>
>I get the following compile error:
>
> Syntax error at line 1417, column 49, file srf.pc:
> EXEC SQL SET TRANSACTION USE ROLLBACK SEGMENT :rback;
> ..............................................................1
> (1) PCC-S-02201, Encountered the symbol ":" when expecting one
> of the following:
>
> an identifier,
>
>It does not like the :rback. If I replace it with the actual value, (e.g.,
>r01), it compiles. What's wrong with the syntax?
>
>Thanks,
>
>Ian
>--
>
>

To my opinion you can only use variables in the statement that are declared in the DECLARE SECTION. Therefore you should declare a variable and set it equal to your user-variable rback before starting the statement.

ir Danny Roosens
Genesys - Belgium Received on Wed Jul 31 1996 - 00:00:00 CEST

Original text of this message