db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sebastian Stepien" <sebast...@ncable.net.au>
Subject forming SQL statements
Date Fri, 20 Oct 2006 08:49:52 GMT
Hi, 

I am a newbie and in urgent help with Derby SQL

Having the tables below 

How would I insert data based on the following pseudo code? Should I be
using Stored procedures?  

 

Insert into EVENT TABLE and ACTION table data and  

If  ACTIONTYPE = Reminder

INSERT INTO Reminder table data

Else If  ACTIONTYPE = Launch

INSERT INTO Launch table data

Else If  ACTIONTYPE = EMAIL

INSERT INTO EMAIL table data

 

private static final String strCreateEventTable =

        "CREATE TABLE APP.EVENT (" +

        "    EVENTID            INTEGER NOT NULL PRIMARY KEY GENERATED
ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1)," +

        "    EVENTDATE          DATE       , " +

        "    EVENTTITLE         VARCHAR(30), " +

        "    EVENTDESCRIPTION   VARCHAR(50), " +

        "    ACTIONID           INTEGER  " +

        ")";

    

    private static final String strCreateActionTable =

        "CREATE TABLE APP.ACTION (" +

        "    ACTIONID           INTEGER NOT NULL PRIMARY KEY GENERATED
ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1)," +

        "    ACTIONTYPE         VARCHAR(8) " +

        ")";

    

    private static final String strCreateReminderTable =

        "CREATE TABLE APP.REMINDER (" +

        "    ACTIONID           INTEGER NOT NULL PRIMARY KEY," +

        "    REMINDERMSG        VARCHAR(100) " +

        ")";

    

    private static final String strCreateLaunchTable =

        "CREATE TABLE APP.LAUNCH (" +

        "    ACTIONID           INTEGER NOT NULL PRIMARY KEY," +

        "    LAUNCHCMD        VARCHAR(50), " +

        "    LAUNCHARG        VARCHAR(50) " +

        ")";

    

    private static final String strCreateEmailTable =

        "CREATE TABLE APP.EMAIL (" +

        "    ACTIONID           INTEGER NOT NULL PRIMARY KEY," +

        "    EMAILSUBJECT       VARCHAR(50), " +

        "    EMAILMSG           VARCHAR(200), " +

        "    CONTACTID          INTEGER " +

        ")";

 

Thanks,

Sebastian

 


-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.408 / Virus Database: 268.13.7/488 - Release Date: 19/10/2006
 

Mime
View raw message