Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2002
    Posts
    1

    Unanswered: generate dynamic DDL statment in Pro*c

    i faced on little problem in pro*c.
    but i can't settle myself.

    i wanna generate dynamic DDL statment in pro*c
    like
    char *table_name = "host";
    CREATE TABLE :table_name(.....);

    but the pro*c doesn't allow DDL statment with variable.

    how can i do for generate dynamic DDL statment??

    thanks...

  2. #2
    Join Date
    Jan 2003
    Location
    Torrance Ca 90210
    Posts
    5

    Re: generate dynamic DDL statment in Pro*c

    No what you are trying is impossible.
    what you need to do is build the create table statement and then
    execute it.

    char *stmt1 = "Create table ";
    char *table_name = "Host";
    char *stmt1 = " (col1 number,col2 date) ";
    char stmt[2000];

    void main()
    {

    /* perform connect */

    strcpy(stmt,stmt1);
    strcat(stmt,table_name);
    strcat(stmt,stmt2);
    exec sql execute immediate :stmt;
    }





    Originally posted by Zerocool
    i faced on little problem in pro*c.
    but i can't settle myself.

    i wanna generate dynamic DDL statment in pro*c
    like
    char *table_name = "host";
    CREATE TABLE :table_name(.....);

    but the pro*c doesn't allow DDL statment with variable.

    how can i do for generate dynamic DDL statment??

    thanks...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •