Home » Developer & Programmer » Precompilers, OCI & OCCI » GLOBAL TEMPORARY TABLES from Pro*C (Oracle 10g in HP-UX B.11.11)
GLOBAL TEMPORARY TABLES from Pro*C [message #328228] Thu, 19 June 2008 07:14 Go to next message
donato
Messages: 53
Registered: November 2007
Location: Barcelona, Spain
Member
Hi all again!
My source code is:
#include <sqlca.h>
#define  SQLCODE   sqlca.sqlcode
void main()
{
   EXEC SQL
      CREATE GLOBAL TEMPORARY
          TABLE table_temp
          (col1 number);
    return(SQLCODE);
}


I'm compiling with this options:
MODE=ANSI CLOSE_ON_COMMIT=NO DYNAMIC=ANSI CODE=ANSI_C
USERID=ORACLE/ORACLE@MYDB

The first error I obtain is:
          TABLE table_temp
..........1
PCC-S-02201, Se ha encontrado el símbolo "TABLE" cuando se esperaba uno de los siguientes:
   ; random_terminal
(...)

Can anybody help me, please? Thanks in advance!
Re: GLOBAL TEMPORARY TABLES from Pro*C [message #328474 is a reply to message #328228] Fri, 20 June 2008 05:23 Go to previous messageGo to next message
donato
Messages: 53
Registered: November 2007
Location: Barcelona, Spain
Member
Hello!
I solved it. Well, is another way to do it, more than a solution. I use 'EXECUTE IMMEDIATE':
void main()
{
    EXEC SQL BEGIN DECLARE SECTION;
        char   query[1000];
    EXEC SQL END DECLARE SECTION;
    
    sprintf(query, "CREATE GLOBAL TEMPORARY TABLE tmp_table (col1 number)");
    EXEC SQL EXECUTE IMMEDIATE :query; 

(...)
}

Regards!
Re: GLOBAL TEMPORARY TABLES from Pro*C [message #328479 is a reply to message #328474] Fri, 20 June 2008 05:38 Go to previous message
Michel Cadot
Messages: 68634
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Thanks for the feedback, it is appreciated.

Regards
Michel
Previous Topic: Bulk fetch of coloumn value
Next Topic: Dynamic SQL Method 4 with VARCHAR2 and DECIMALS
Goto Forum:
  


Current Time: Tue Apr 16 01:04:10 CDT 2024