Create Oracle tables from ArcView using Avenue

Last Published: April 25, 2020


This article provides examples on how to connect to Oracle and perform various operations within Oracle using Avenue.


  1. Create a Data Source Name (DSN) named 'Oracle' to the Oracle database.

    A. Click Start > Settings > Control Panel.
    B. Double-click the ODBC32 Administrator icon.
    C. Select the User DSN tab, then click the Add button.
    D. Select the Oracle ODBC Driver and click the Finish button.
    E. Type in a name for the DSN in the Data Source Name field, for example 'Addresses'.
    F. Enter the Service Name.
    G. Click OK.
    H. Click OK to close the ODBC Administrator dialog box.

  2. Open four new script windows.

    A. Activate the Project window.
    B. Click the Scripts icon.
    C. Click New.

  3. Copy and paste each of the following scripts into a separate script window.

    '-- Script Name: SQLConnect.Oracle


    '-- This SQLCON statement is specific to our ODBC definition.
    '-- You will need to replace DIRPIMS 7 with your database name.

    '-- Verify connection to Oracle was susccessful.
    if (_theSQL.IsLogin=false) then

    The following scripts create three tables in Oracle and put some records in them.

    '-- Script Name: SQLConnect.Tables

    '-- Create ARCVIEW_SESSION table in Oracle
    theCreateSesTableSQL="Create table arcview_session (session_id number(3), session_name char(15), end_dt date)"

    '-- Create ARCVIEW_USER table in Oracle
    theCreateUserTableSQL="Create table arcview_user (user_id number(3), user_name char(15))"

    '-- Create USER_SESSION table in Oracle
    theCreateUserSesTableSQL="Create table user_session (user_id number(3), session_id number(3))"

    '-- Insert new ARCVIEW_SESSION record
    theInsertSessionSQL="Insert into arcview_session (session_id, session_name) values(1, 'TestSession 1')"

    '-- Insert another ARCVIEW_SESSION record
    theInsertSession2SQL="Insert into arcview_session (session_id, session_name) values(2, 'TestSession 2')"

    '-- Insert new ARCVIEW_USER record
    theInsertSessionSQL="Insert into arcview_user values(5, 'Sam Smith')"

    '-- Insert another ARCVIEW_USER record
    theInsertSession2SQL="Insert into arcview_user values(6, 'Jenny Jones')"

    '-- Insert another ARCVIEW_USER record
    theInsertSession3SQL="Insert into arcview_user values(7, 'Mike McMann')"

    '-- Insert new USER_SESSION record
    theUserSesSQL="Insert into user_session values(6,2)"

    '-- Script Name: SQLSession.Record

    '-- This script gets the SESSION_ID and USER_ID from Oracle and creates a session record

    '-- Get the USER_ID from Oracle
    theUserIDSQL="Select user_id from arcview_user where user_name = 'Sam Smith'"
    for each record in theUserIDVTab

    '-- Get the SESSION_ID from Oracle
    theSessionIDSQL="Select session_id from arcview_session where session_name ='TestSession 1'"
    for each record in theSessionIDVTab

    '-- Create new USER_SESSION record
    theUserSessionSQL="Insert into user_session values("+_theUserID+","+_theSessionID+")"

    '-- Script Name: SQLAdd.Date

    '-- Add the SESSION END DATE to the SESSION record
    theEndDTSQL="Update arcview_session set end_dt = (select sysdate from dual) where session_id ="+_theSessionID+""

    '-- Delete the USER_SESSION record for this user and session
    theDeleteSQL="Delete from user_session where session_id ="+_theSessionID+" and user_id="+_theUserID+""

    '-- Log off from Oracle

    '-- If you run this script, be sure to rerun the &1LogOntoOracle
    '-- and &3CreateSesRecord scripts again to reconnect to Oracle and
    '-- Re-enter the USER_SESSION record that was deleted here

  4. Rename each script to its appropriate name in the header.

    A. Select Properties from the Script menu.
    B. Type in a new name in the Name field.
    C. Click OK.

  5. Attach each script to a button on the Project GUI.

    A. Compile the script.
    B. Switch to the Project window.
    C. Select Customize from the Project menu.
    D. On the Customize dialog, select Project under Type dropdown.
    E. Select Buttons under Category.
    F. Click the New button.
    G. Double-click the Click property in the Customize dialog box.
    H. Enter the name of the script in the Script Manager and click Select.
    I. Close the Customize dialog box.

    For more information, see 'Customize dialog box' in ArcView Help.

  6. Click each button in this order:

    a. Click the button for SQLConnect.Oracle script.
    b. Click the button for SQLCreate.Tables script.
    c. Click the button for SQLSession.Record script.
    d. Click the button for SQLAdd.Date script.

    [O-Image] Edit Oracle table using Avenue

Article ID:000003923

  • Legacy Products

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options

Discover more on this topic