Results 1 to 7 of 7

Thread: creating tables in oracle 9i using vb 6.0

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2006
    Posts
    4

    Unhappy creating tables in oracle 9i using vb 6.0

    hi ,
    i want to create tables at oracle9i using vb 6.0 at runtime.I would be grateful to anyone who can help me inthis regard.i'm using windows 2000,oracle 9i,vb 6.0 and ado 2.5.
    ----------biplab------------

  2. #2
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: creating tables in oracle 9i using vb 6.0

    You just need to write "Create Table..." sql statement and execute it via say ADO connection.
    Here is a sample logic:
    VB Code:
    1. Private Sub Command1_Click()
    2. Dim strSQL$
    3.  
    4.     strSQL = "CREATE TABLE USER_LOGIN" & vbNewLine
    5.     strSQL = strSQL & "    (LNAME  VARCHAR2(24) NOT NULL," & vbNewLine
    6.     strSQL = strSQL & "     FNAME  VARCHAR2(24) NOT NULL," & vbNewLine
    7.     strSQL = strSQL & "     LOGIN_ID   VARCHAR2(16) NOT NULL," & vbNewLine
    8.     strSQL = strSQL & "     PWD        VARCHAR2(10) NOT NULL)" & vbNewLine
    9.     strSQL = strSQL & "PCTFREE 10" & vbNewLine
    10.     strSQL = strSQL & "PCTUSED 40" & vbNewLine
    11.     strSQL = strSQL & "INITRANS 1" & vbNewLine
    12.     strSQL = strSQL & "MAXTRANS 255" & vbNewLine
    13.     strSQL = strSQL & "TABLESPACE TABLE_SPACE1" & vbNewLine
    14.     strSQL = strSQL & "STORAGE" & vbNewLine
    15.     strSQL = strSQL & "    (INITIAL     1048576" & vbNewLine
    16.     strSQL = strSQL & "     NEXT        1048576" & vbNewLine
    17.     strSQL = strSQL & "     PCTINCREASE 0" & vbNewLine
    18.     strSQL = strSQL & "     MINEXTENTS  1" & vbNewLine
    19.     strSQL = strSQL & "     MAXEXTENTS  505)" & vbNewLine
    20.     strSQL = strSQL & "/" & vbNewLine
    21.     strSQL = strSQL & "GRANT DELETE ON USER_LOGIN TO END_USER" & vbNewLine
    22.     strSQL = strSQL & "/" & vbNewLine
    23.     strSQL = strSQL & "GRANT INSERT ON USER_LOGIN TO END_USER" & vbNewLine
    24.     strSQL = strSQL & "/" & vbNewLine
    25.     strSQL = strSQL & "GRANT SELECT ON USER_LOGIN TO END_USER" & vbNewLine
    26.     strSQL = strSQL & "/" & vbNewLine
    27.     strSQL = strSQL & "GRANT UPDATE ON USER_LOGIN TO END_USER" & vbNewLine
    28.     strSQL = strSQL & "/"
    29.    
    30.     adoConnection.Execute strSQL
    31.  
    32. End Sub

  3. #3
    New Member
    Join Date
    Mar 2006
    Posts
    9

    Re: creating tables in oracle 9i using vb 6.0

    how with drop/create table and insert into table on file sql to stored into Oracle 10g with VB 6.0?

  4. #4
    A SQL Server fool GaryMazzone's Avatar
    Join Date
    Aug 2005
    Location
    Dover,NH
    Posts
    7,493

    Re: creating tables in oracle 9i using vb 6.0

    You also need to ensure that the user has quota on the tablespace that the table will be created in, and that they have the create objects privaliage, either granted to the role the user has or as an individual.
    Sometimes the Programmer
    Sometimes the DBA

    Mazz1

  5. #5
    A SQL Server fool GaryMazzone's Avatar
    Join Date
    Aug 2005
    Location
    Dover,NH
    Posts
    7,493

    Re: creating tables in oracle 9i using vb 6.0

    bludab-- You need to explain what you're asking for hear. I have absolutley no idea what question you are asking.
    Sometimes the Programmer
    Sometimes the DBA

    Mazz1

  6. #6
    New Member
    Join Date
    Mar 2006
    Posts
    9

    Re: creating tables in oracle 9i using vb 6.0

    my idea:
    i will input sql file to stored Oracle Server use VB 6, this file contains: drop,crate alter and insert (sql statement)...
    that its!
    thanks

  7. #7
    A SQL Server fool GaryMazzone's Avatar
    Join Date
    Aug 2005
    Location
    Dover,NH
    Posts
    7,493

    Re: creating tables in oracle 9i using vb 6.0

    Are you always going to drop create alter the same table or user? If not you need to execute them from the program and build the SQL as needed. If you store the data partially on the server (in some table that holds a bunch of different SQL commands) you need to be able to set up Oracle replacement values (using the amper sign (&)) this can be a big problem for someone not very familar with Oracle. You may also need to use the execute immediate SQL statement if you modify the SQL using replacement variable and it is used inside a Stored Procedure (or ananonomus block).
    Sometimes the Programmer
    Sometimes the DBA

    Mazz1

Posting Permissions

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



Click Here to Expand Forum to Full Width