Create table dynamic SQL using SQLRPGLE

Tags:
SQL
SQLRPGLE
Hi. How can I create table using dynamic SQL using SQLRPGLE?


Software/Hardware used:
AS400 i series
0

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Discuss This Question: 3  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • TheRealRaven
    Create the "CREATE TABLE" statement in a variable and then execute the resulting SQL statement with EXEC SQL PREPARE and EXEC SQL EXECUTE.
    34,430 pointsBadges:
    report
  • ToddN2000
    Raven has the right idea. Define a large variable. Then build your CREATE TABLE command by concatenating the other elements needed to build your table. If you have any issues, come back with a sample of your code and we can try and help further.
    131,585 pointsBadges:
    report
  • amiruladli95
    This is my code:
    sqlcmd= 'CREATE TABLE dvp8701lib/testpf'+Var2+
            '(testf varchar(140))';               
                                                  
    Exec SQL Prepare crtstmt from :sqlcmd;        
    Exec SQL EXECUTE crtstmt;                     
                                                  
    EXEC SQL                                      
    SET OPTION COMMIT = *NONE;                    
    40 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: