Help Required :Excel Upload Into Oracle Table Using PLSQL Procedure/Package

Please Help , Urgent Help Needed.
Requirement is to Upload Excel file Into Oracle Table Using PLSQL Procedure/Package.
Case's are :
1. Excel File is On Users/ Client PC.
2. Application is on Remote Server(Oracle Forms D2k).
3. User Is Using Application Using Terminal Server LogIn.
4. So If User Will Use to GET_FILE_NAME() function of D2K to Get Excel File , D2k Will Try to pick File from That Remote Server(Bcs User Logind from Terminal Server Option).
5. Cannot Use Util_File Package Or Oracle Directory to Place That File on Server.
6. we are Using Oracle 8.7
So Need Some PL/SQL Package or Fuction/ Procedure to Upload Excel file on User's Pc to Oracle Table.
Please Guide me wd some Code. or with Some Pl/SQL Package, or With SOme Hint. Or any Link ....
Jus help to Sort This Issue ........
you can also write me on :
[email protected], [email protected]

I also Tried to Use This
But How can i Use SQLLDR Command In Stored Procedure.
Well IN SQL*PlUS it is successfull but in Stored Procedure /Package ,PL/SQL does not recognise the OS commands.
So now my Question How can I recognise the SQLLDR Commnad in Stored Procedure.

Similar Messages

  • Help Required:How Upload Excel file Into Oracle Table Using PLSQL Procedure

    Please Help , Urgent Help Needed.
    Requirement is to Upload Excel file Into Oracle Table Using PLSQL Procedure/Package.
    Case's are :
    1. Excel File is On Users/ Client PC.
    2. Application is on Remote Server(Oracle Forms D2k).
    3. User Is Using Application Using Terminal Server LogIn.
    4. So If User Will Use to GET_FILE_NAME() function of D2K to Get Excel File , D2k Will Try to pick File from That Remote Server(Bcs User Logind from Terminal Server Option).
    5. Cannot Use Util_File Package Or Oracle Directory to Place That File on Server.
    6. we are Using Oracle 8.7
    So Need Some PL/SQL Package or Fuction/ Procedure to Upload Excel file on User's Pc to Oracle Table.
    Please Guide me wd some Code. or with Some Pl/SQL Package, or With SOme Hint. Or any Link ....
    Jus help to Sort This Issue ........
    you can also write me on :
    [email protected], [email protected]

    TEXT_IO is a PL/SQL package available only in Forms (you'll want to post in the Forms forum for more information). It is not available in a stored procedure in the database (where the equivalent package is UTL_FILE).
    If the Terminal Server machine and the database machine do not have access to the file system on the client machine, no application running on either machine will have access to the file. Barring exceptional setups (like the FTP server on the client machine), your applications are not going to have more access to the client machine than the operating system does.
    If you map the client drives from the Terminal Server box, there is the potential for your Forms application to access those files. If you want the files to be accessible to a stored procedure in the database, you'll need to move the files somewhere the database can access them.
    Justin

  • Importing excel data into oracle tables

    Hello gurus,
    Importing excel data into oracle tables..
    I know this is the most common question on the thread ...First, i searched the forum, i found bunch of threads with loading data using sqlloader, converting excel into .Txt, tab delimited file, .csv file etc....
    Finally i was totally confused in terms how to get this done....
    Here is wat i have
       - Excel file on local computer.
       - i have laod data into dev environment tables(So no risk involved, but want to try something simple)
       - Oracle version 11.1.0.7
       - Sqlplus and toad (editors)
    Here is wat i like to do ....i dont know if its possible
        - Without going to unix server can i do everthing on local system by making use of oracle db and sqlplus or toad
       SQLLOADER might be one option...but i dont want to go the unix server for placing files and logs and stuff.
    Wat will be best and simplest option to do?? and wat format will best to convert from excel into csv, or txt or tab delimited etc.....
    If you suggest sqlloader, any code example will be greatly appriciated.
    Thank you so much!!!

    Hi,
    user642297 wrote:
    Imran,
    This is increadible option in toad!!! It works absolutely sweet!! I have toad 9.7 version. IT works great. Thank you so much!!You are welcome :)
    Well i have further discussion on this ....this option is great if you doing in staging or development area. What if your doing in prod?? If you automating the sqlloader then how do u do it?? I think we still need to stick with traditional approach of laoding data by making use of SQLLoader right ?? If m wrong please correct me.well, in our case, we do have access to a custom schema in prod where we create the staging table and load the data from datafiles.
    try this:
    load data
    infile 'C:\dest.csv'
    into table dest_table
    fields terminated by "~" optionally enclosed by '"'
    TRAILING NULLCOLS
    (name,
    owner_nm,
    description_column,
    UPDT_DT DATE 'MM/DD/YYYY')
    {code}
    you can get more info about sql loader and your error here:
    http://download.oracle.com/docs/cd/B10501_01/server.920/a96652/ch05.htm
    http://www.allinterview.com/showanswers/53766.html
    And one more quick question ...i found an example of control file , in that i see .dat format file. Is it a data file ?? can i try that option ?? But in excel i didnt see to convert the .dat format file.
    Any thoughts ???
    It is same as a delimiter text file.
    steps to create a .dat file (from a excel file):
    1. Insert a column between two columns and populate it with the delimiter (in our case, it is ~)
    2. Save the file as unicode text.
    3. Open the file in text editor and remove all the tabs (find an replace with blank)
    4. Save the file as "DEST.dat". Select encoding as UTF-8 while saving.
    5. Your .dat file is ready.
    Regards
    Imran
    Edited by: Imran Soudagar on Apr 22, 2010 10:22 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Want to load excel data into oracle table with out changing it to CSV

    Hello all,
    I have a requirement in dumping excel data into oracle database table without changing it to CSV file and this has to be used in normal sql/plsql environment i.e., pkg/procedure cant be used in the forms also...
    so, can u guys can help me out in this
    thanks.............

    The link Pavan provided discusses Oracle Heterogeneous Services. This allows you (using ODBC) to create a database link from Oracle to a non-Oracle data source like Excel. This would allow you to query the Excel data source from SQL*Plus or any other client tool. But that is probably going to require that your Oracle database is running on Windows since I'm not aware of any Excel ODBC drivers for Unix.
    Another potential option would be to write a Java stored procedure that parsed the file. There are a few different Java libraries that can read and write Excel data files. You could load one of those libraries into the database's JVM and then write Java code that parsed the file. You would then be able to call your Java stored procedure from PL/SQL.
    Justin

  • Map Excel worksheet into Oracle tables in repository

    I am new to VB2005. I am working on VB code that can map(read) any table from excel worksheet and load it into Oracle tables. Oracle tables that I have are: 1)META_OBJECTTYPES
    (OBJECTTYPEID pk,OBJECTTYPENAME,OBJECTTYPEDESC, OBJECTMETATYPE,OBJECTDOMAIN).
    2) META_OBJECTS(OBJECTKEY PK,OBJECTTYPEID FK,OBJECTNAME,OBJECTDESC).
    3)META_OBJECTDEPENDENCIES(SRCOBJECTKEY FK, TGTOBJECTKEY FK,DEPENDENCYTYPE PK)
    4)META_OBJECTATTRIBUTES
    (OBJECTKEY FK, OBJECTATTRNAME PK,OBJECTATTRVALUE).
    NOTICE META_OBJECTTYPES IS PARENT TO META_OBJECTS AND META_OBJECTS IS PARENT TO (META_OBJECTDEPENDENCIES AND META_OBJECTATTRIBUTES) AND ALL PARENT HAS 1 TO MANY REALTIONSHIP TO CHILD TABLES. For example, I have employee table in Excel worksheet that has two columns employee_id number, employee_name varchar2(50) I need my vb code map table name employee with its 2 columns into my 4 tables that I have in Oracle table repository,
    My code so far just insert values into oracle tables in repository, but what is require is mapping table with contents into oracle tables. If my expanation isn't clear plz let me know.
    Imports System
    Imports System.Data
    Imports Oracle.DataAccess.Client '
    Imports Excel = Microsoft.Office.Interop.Excel
    Public Class Form1
    'System.Data.OracleClient lets you access Oracle databases.
    Public con As System.Data.OracleClient.OracleConnection = NewSystem.Data.OracleClient.OracleConnection()
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Dim xlApp As Excel.Application
    Dim xlWorkBook As Excel.Workbook
    Dim xlWorkSheet As Excel.Worksheet
    Dim range As Excel.Range
    Dim rCnt As Integer
    Dim cCnt As Integer
    Dim Obj As Object
    xlApp = New Excel.ApplicationClass
    xlApp.Visible = True
    xlWorkBook = xlApp.Workbooks.Open("c:\employee.xls")
    xlWorkSheet = xlWorkBook.Worksheets("sheet1")
    range = xlWorkSheet.UsedRange
    For rCnt = 2 To range.Rows.Count 'rows in Excel start from row2
    For cCnt = 1 To range.Columns.Count 'column in Excel start from col1
    Obj = CType(range.Cells(rCnt, cCnt), Excel.Range)
    MsgBox(Obj.value)
    Next
    Next
    xlWorkBook.Close()
    xlApp.Quit()
    releaseObject(xlApp)
    releaseObject(xlWorkBook)
    releaseObject(xlWorkSheet)
    End Sub
    Private Sub releaseObject(ByVal obj As Object)
    Try
    System.Runtime.InteropServices.Marshal.ReleaseComObject(obj)
    obj = Nothing
    Catch ex As Exception
    obj = Nothing
    Finally
    GC.Collect()
    End Try
    End Sub
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Dim daOracle As New OracleDataAdapter
    Dim InsertCommand As New OracleCommand
    daOracle.InsertCommand = New OracleCommand
    '1.Create connection object to Oracle database
    Dim con As OracleConnection = New OracleConnection()
    Try
    '2.Specify connection string
    con.ConnectionString = ("Data Source=gema;User Id=dare; Password=rtae")
    '3. Open the connection through ODP.NET
    con.Open()
    Dim cmd As OracleCommand = New OracleCommand
    cmd.Connection = con
    cmd.CommandType = CommandType.Text
    cmd.CommandText = "insert into meta_objecttypes values (4,'TABLE', 'TABLES','ERstudio','Demo')"
    cmd.ExecuteNonQuery()
    'You have to commit to be inserted into DB
    cmd.CommandText = "commit"
    cmd.ExecuteNonQuery()
    Finally
    ' Close and Dispose OracleConnection object
    con.Close()
    con.Dispose()
    End Try
    End Sub
    Private Sub Add_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Add.Click
    Dim daOracle As New OracleDataAdapter
    Dim InsertCommand As New OracleCommand
    daOracle.InsertCommand = New OracleCommand
    '1.Create connection object to Oracle database
    Dim con As OracleConnection = New OracleConnection()
    Try
    If TableName.Text = "" Then
    MsgBox("Please enter the tablename", MsgBoxStyle.Exclamation, "OraScan")
    Exit Sub
    End If
    MsgBox(TableName.Text, MsgBoxStyle.Exclamation, "OraScan")
    '2.Specify connection string
    con.ConnectionString = ("Data Source=gema;User Id=dare; Password=rtae")
    '3. Open the connection through ODP.NET
    con.Open()
    Dim cmd As OracleCommand = New OracleCommand
    cmd.Connection = con
    cmd.CommandType = CommandType.Text
    cmd.CommandText = "select * from user_objects where object_name='" + UCase(TableName.Text) + "' and object_type='TABLE'"
    cmd.ExecuteNonQuery()
    'You have to commit to be inserted into DB
    'cmd.CommandText = "commit"
    'cmd.ExecuteNonQuery()
    MsgBox("Command executed successfully", MsgBoxStyle.Exclamation, "OraScan")
    Finally
    ' Close and Dispose OracleConnection object
    con.Close()
    con.Dispose()
    End Try
    End Sub
    Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TableName.TextChanged
    End Sub
    End Class

    Don't know if this will help you or not, but I have some code that will read from and Excel spreadsheet and put the data into a DataSet (i'm sure something else could be used).
    string connectionString =
    @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=d:\\testRead.xls;Excel 12.0;HDR=YES;IMEX=1";
    DbProviderFactory factory =
    DbProviderFactories.GetFactory("System.Data.OleDb");
    DbDataAdapter adapter = factory.CreateDataAdapter();
    DbCommand selectCommand = factory.CreateCommand();
    selectCommand.CommandText = "SELECT * FROM [dogs$]";
    DbConnection connection = factory.CreateConnection();
    connection.ConnectionString = connectionString;
    selectCommand.Connection = connection;
    adapter.SelectCommand = selectCommand;
    DataSet cities = new DataSet();
    adapter.Fill(cities);
    GridView1.DataSource = cities;
    GridView1.DataBind();
    Your provider might be different; the one above is for Office 2007. The [dogs$] in the selectCommand.commandText is the name of the worksheet in Excel.
    Hope this helps

  • Map Excel worksheet into Oracle tables repository

    I am new to VB2005. I am working on VB code that can map(read) any table from excel worksheet and load it into Oracle table. Oracle table that I have are: 1)META_OBJECTTYPES(OBJECTTYPEID pk,OBJECTTYPENAME,OBJECTTYPEDESC, OBJECTMETATYPE,OBJECTDOMAIN).
    2) META_OBJECTS(OBJECTKEY PK,OBJECTTYPEID FK,OBJECTNAME,OBJECTDESC).
    3)META_OBJECTDEPENDENCIES(SRCOBJECTKEY FK, TGTOBJECTKEY FK,DEPENDENCYTYPE PK)
    4)META_OBJECTATTRIBUTES((OBJECTKEY FK, OBJECTATTRNAME PK,OBJECTATTRVALUE). NOTICE META_OBJECTTYPES IS PARENT TO META_OBJECTS AND META_OBJECTS IS PARENT TO (META_OBJECTDEPENDENCIES AND META_OBJECTATTRIBUTES) AND ALL PARENT HAS 1 TO MANY REALTIONSHIP TO CHILD TABLES. For example I have employee table in Excel worksheet that has two columns employee_id number, employee_name varchar2(50) I need my vb code map table name employee with its 2 columns into my 4 tables that I have in Oracle repository,
    My code so far just insert values into oracle tables in repository, but what is require is mapping table with contents into oracle tables.
    Imports System
    Imports System.Data ' VB.NET
    Imports Oracle.DataAccess.Client ' ODP.NET Oracle data provider
    Imports Excel = Microsoft.Office.Interop.Excel
    Public Class Form1
    'System.Data.OracleClient lets you access Oracle databases.
    Public con As System.Data.OracleClient.OracleConnection = New System.Data.OracleClient.OracleConnection() 'Oracle.DataAccess.Client.OracleConnection()
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Dim xlApp As Excel.Application
    Dim xlWorkBook As Excel.Workbook
    Dim xlWorkSheet As Excel.Worksheet
    Dim range As Excel.Range
    Dim rCnt As Integer
    Dim cCnt As Integer
    Dim Obj As Object
    xlApp = New Excel.ApplicationClass
    xlApp.Visible = True
    xlWorkBook = xlApp.Workbooks.Open("c:\employee.xls")
    xlWorkSheet = xlWorkBook.Worksheets("sheet1")
    range = xlWorkSheet.UsedRange
    For rCnt = 2 To range.Rows.Count
    For cCnt = 1 To range.Columns.Count
    Obj = CType(range.Cells(rCnt, cCnt), Excel.Range)
    MsgBox(Obj.value)
    Next
    Next
    xlWorkBook.Close()
    xlApp.Quit()
    releaseObject(xlApp)
    releaseObject(xlWorkBook)
    releaseObject(xlWorkSheet)
    End Sub
    Private Sub releaseObject(ByVal obj As Object)
    Try
    System.Runtime.InteropServices.Marshal.ReleaseComObject(obj)
    obj = Nothing
    Catch ex As Exception
    obj = Nothing
    Finally
    GC.Collect()
    End Try
    End Sub
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Dim daOracle As New OracleDataAdapter
    Dim InsertCommand As New OracleCommand
    daOracle.InsertCommand = New OracleCommand
    '1.Create connection object to Oracle database
    Dim con As OracleConnection = New OracleConnection()
    Try
    '2.Specify connection string
    con.ConnectionString = ("Data Source=dprod;User Id=smughrabi; Password=Sul9966")
    '3. Open the connection through ODP.NET
    con.Open()
    Dim cmd As OracleCommand = New OracleCommand
    cmd.Connection = con
    cmd.CommandType = CommandType.Text
    cmd.CommandText = "insert into meta_objecttypes values (4,'TABLE', 'TABLES','ERstudio','Demo')"
    cmd.ExecuteNonQuery()
    'You have to commit to be inserted into DB
    cmd.CommandText = "commit"
    cmd.ExecuteNonQuery()
    'Catch ex As Exception
    '4.display if any error occurs
    'MsgBox(ex.Message, Microsoft.VisualBasic.MsgBoxStyle.Exclamation, "OraScan")
    Finally
    ' Close and Dispose OracleConnection object
    con.Close()
    con.Dispose()
    End Try
    End Sub
    Private Sub Add_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Add.Click
    Dim daOracle As New OracleDataAdapter
    Dim InsertCommand As New OracleCommand
    daOracle.InsertCommand = New OracleCommand
    '1.Create connection object to Oracle database
    Dim con As OracleConnection = New OracleConnection()
    Try
    If TableName.Text = "" Then
    MsgBox("Please enter the tablename", MsgBoxStyle.Exclamation, "OraScan")
    Exit Sub
    End If
    MsgBox(TableName.Text, MsgBoxStyle.Exclamation, "OraScan")
    '2.Specify connection string
    con.ConnectionString = ("Data Source=gema;User Id=dare; Password=rtae")
    '3. Open the connection through ODP.NET
    con.Open()
    Dim cmd As OracleCommand = New OracleCommand
    cmd.Connection = con
    cmd.CommandType = CommandType.Text
    cmd.CommandText = "select * from user_objects where object_name='" + UCase(TableName.Text) + "' and object_type='TABLE'"
    cmd.ExecuteNonQuery()
    'You have to commit to be inserted into DB
    'cmd.CommandText = "commit"
    'cmd.ExecuteNonQuery()
    MsgBox("Command executed successfully", MsgBoxStyle.Exclamation, "OraScan")
    'Catch ex As Exception
    '4.display if any error occurs
    'MsgBox(ex.Message, Microsoft.VisualBasic.MsgBoxStyle.Exclamation, "OraScan")
    Finally
    ' Close and Dispose OracleConnection object
    con.Close()
    con.Dispose()
    End Try
    End Sub
    Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TableName.TextChanged
    End Sub
    End Class

    Thanks Lyndon, what I need is map any table someone create in Excel worksheet to Oracle repository.For example to map Excel worksheet(employee)table with its 2 columns to oracle table META_OBJECTTYPES(OBJECTTYPEID pk,OBJECTTYPENAME,OBJECTTYPEDESC, OBJECTMETATYPE,OBJECTDOMAIN). In my case I have 2 objecttypes 1)table(employee) and 2nd columns:employee_id,employee_name
    --for inserting table info manually into DB:
    INSERT INTO META_OBJECTS
    (OBJECTKEY, OBJECTTYPEID,OBJECTNAME,OBJECTDESC)
    VALUES
    (META_OBJECTS_SEQ.NEXTVAL,
    4, --TABLE  
    'employee',--notice this is table name from Excel worksheet
    'Table to store employee info')
    --for inserting columns info:
    INSERT INTO META_OBJECTS
    (OBJECTKEY, OBJECTTYPEID,OBJECTNAME,OBJECTDESC)
    VALUES
    (META_OBJECTS_SEQ.NEXTVAL,5,'employee_id or name','employee column')
    notice above I insert manually Excel worksheet employee table with its two cols into oracle meta_objecttypes. What I want is VB to do this I mean if I go to Toad and erase what I insert in meta_objecttypes when I run vb, the program should map table employee with its 2 cols to Toad(DB). I hope it is clear now. Please refer to 1 st post for 3 other tables in DB

  • Can select, but cannot insert into oracle tables using php.

    I am having trouble inserting data into a tables in oracle using PHP. I can insert into the tables using baninst1, but nothing else. I can't even insert using the tables' owner. Every time I try I get the ORA-00492 error of table or view does not exist. However, I can run a select statement just fine. So far, baninst1 is the only user that can actually do inserts. I've triple checked all the table grants and everything is fine. Also, I can copy/paste the exact insert statement into SQL*Plus and it works with the correct user. It doesn't have to be baninst1. I've tried everything I can think of. I've tried putting the table name in quotes, adding the schema name to the table, checking public synonyms, but everything appears to be ok. I would greatly appreciate any suggestions others may have.
    I'm using PHP 5.2.3 with an oracle 9i DB.

    Here is the code that doesn't work. It works only with baninst1, no other username will work and all I do is change the my_username/my_password to something different. This is one example function where I try to do an insert, but it doesn't work on any of the tables I try.
    Thanks for looking.
    class Oracle {
         private $oracleUser = "my_username";
         private $oraclePassword = "my_password";
         private $oracleDB = "MY_DB";
         private $c = null;
         function Connect() {
              if ( !($this->c = ocilogon( $this->oracleUser, $this->oraclePassword, $this->oracleDB ) ) )
                   return false;
              return true;
         function AddNewTest($testName, $course, $section, $term, $maxAttempts, $length, $startDate, $startTime, $endDate, $endTime)
              $result = "";
              if( $this->c == null )
                   $this->Connect();     
              $splitIndex = strpos($course, " ");
              $subjectCode = substr($course, 0, $splitIndex);
              $courseNumber = substr($course, $splitIndex + 1);
              $insertStatment = "insert into szbtestinfo(szbtestinfo_test_name,
                                                                szbtestinfo_course_numb,
                                                           szbtestinfo_section,
                                                                szbtestinfo_max_attempts,
                                                                szbtestinfo_length_minutes,
                                                                szbtestinfo_start,
                                                                szbtestinfo_end,
                                                                szbtestinfo_id,
                                                                szbtestinfo_subj_code,
                                                                szbtestinfo_eff_term)
                                                                values( '" . $testName .
                   "', '" . $courseNumber .
                   "', '" . $section .
                   "', " . $maxAttempts .
                   ", " . $length .
                   ", to_date('" . $startDate . " " . $startTime . "', 'MM/DD/YYYY HH24:MI')" .
                   ", to_date('" . $endDate . " " . $endTime . "', 'MM/DD/YYYY HH24:MI')" .
                   ", szsnexttest.nextval" .
                   ", '" . $subjectCode .
                   "', '" . $term . "')";
              //return $insertStatment;
              $s = OCIParse($this->c, $insertStatment);
              try
                   $result = OCIExecute($s);
              catch(exception $e)
              return $result;
         }

  • How to insert into a table using a procedure in a trigger

    I have following trigger and based on the some condition, it should inser a row in to a table using the procedure:
    CREATE OR REPLACE TRIGGER RSSC.RR_SERV_ADD_ON_REQ_bu before update on RSSC.RR_SERV_ADD_ON_REQ
    for each row
    DECLARE
    lr_appr_trans_hdr APPR_TRANS_HDR%ROWTYPE;
    -- Inserting a row into APPR_TRANS_HDR table
              lr_appr_trans_hdr.apth_ref_system := 'RSAO';
              lr_appr_trans_hdr.apth_xref_col_name := 'RSAO_ADD_ON_REQ_NUM';
              lr_appr_trans_hdr.apth_xref_id := :NEW.RSAO_ADD_ON_REQ_NUM;
              lr_appr_trans_hdr.apth_trans_srce := 'I';
              lr_appr_trans_hdr.apth_balance_amt := :NEW.RSAO_TOT_AMT;
              lr_appr_trans_hdr.apth_is_finance_adj := 'N';
              SPI_APPR_TRANS_HDR (
              lr_appr_trans_hdr.apth_id
              ,lr_appr_trans_hdr.apth_create_dt
                   ,lr_appr_trans_hdr.apth_create_user_id
                   ,lr_appr_trans_hdr.apth_update_dt
                   ,lr_appr_trans_hdr.apth_update_user_id
              ,lr_appr_trans_hdr.apth_ref_system
                   ,lr_appr_trans_hdr.apth_xref_col_name
                   ,lr_appr_trans_hdr.apth_xref_id
                   ,lr_appr_trans_hdr.apth_trans_srce
                   ,lr_appr_trans_hdr.apth_udc_name_cd
                   ,lr_appr_trans_hdr.apth_udc_acct_num
                   ,lr_appr_trans_hdr.apth_level1_apprvl_stat
                   ,lr_appr_trans_hdr.apth_level1_apprvl_dt
                   ,lr_appr_trans_hdr.apth_level1_apprvr_id
                   ,lr_appr_trans_hdr.apth_level2_apprvl_stat
                   ,lr_appr_trans_hdr.apth_level2_apprvl_dt
                   ,lr_appr_trans_hdr.apth_level2_apprvr_id
                   ,lr_appr_trans_hdr.apth_received_dt
                   ,lr_appr_trans_hdr.apth_balance_amt
                   ,lr_appr_trans_hdr.apth_cust_name
                   ,lr_appr_trans_hdr.apth_sent_dt
                   ,lr_appr_trans_hdr.apth_wbs_element
                   ,lr_appr_trans_hdr.apth_gl_acct_num
                   ,lr_appr_trans_hdr.apth_is_finance_adj );
    When I use the above, it is saying wrong number of argument or type.
    When I use the following instead, I am getting :NEW.APTH_ID must be declared.
    SPI_APPR_TRANS_HDR('APPR_TRANS_HDR',to_char(:NEW.APTH_ID),'APTH_ID',:OLD.APTH_ID,:NEW.APTH_ID);
    How can use the procedure in a trigger.
    Following is the table structure:
    Column Name     Data Type     Column Comments
    APTH_ID     NUMBER(16) Computed unique identified per large table standards (yyyymmddnnnnnnnn)
    APTH_CREATE_DT     DATE     sysdate
    APTH_CREATE_USER_ID VARCHAR2(65)     ‘conv’
    APTH_UPDATE_DT     DATE     sysdate
    APTH_UPDATE_USER_ID     VARCHAR2(65)     ‘conv’
    APTH_REF_SYSTEM     VARCHAR2(4)     ‘RSAO’
    CPA_PREM_NUM     NUMBER(13,0)     NULL
    RSR_REQ_NUM     NUMBER(16)     NULL
    RSAO_ADD_ON_REQ_NUM     NUMBER(16)     rsao_add_on_req_num
    APTH_TRANS_SRCE     VARCHAR2(2)     ‘I’
    APTH_LDC_NAME_CD     VARCHAR2(4)     NULL
    APTH_LDC_ACCT_NUM     VARCHAR2(25)     NULL
    APTH_LEVEL1_APPROVAL_STAT     VARCHAR2(1)     NULL
    APTH_LEVEL1_APPROVAL_DT     DATE     NULL.
    APTH_LEVEL1_APPROVAL_ID     VARCHAR2(30)     NULL
    APTH_LEVEL2_APPROVAL_STAT     VARCHAR2(1)     NULL
    APTH_LEVEL2_APPROVAL_DT     DATE     NULL.
    APTH_LEVEL2_APPROVAL_ID     VARCHAR2(30)     NULL
    APTH_RECEIVED_DT     DATE     NULL
    APTH_BALANCE_AMT     NUMBER(11,2) RR_SERV_ADD_ON_REQ.rsao_tot_amt – amount previously extracted to sap
    APTH_CUST_NAME     VARCHAR2(65)     NULL
    APTH_SENT_DT     DATE     NULL
    APTH_WBS_ELEMENT     VARCHAR2(25)     NULL
    APTH_GL_ACCT_NUM     VARCHAR2(15) NULL
    APTH_IS_FINANC_ADJ     VARCHAR2(1)     ‘N’
    Edited by: user652807 on Sep 3, 2008 4:51 PM

    It appears you're missing the format mask in the TO_CHAR, ...
    TO_CHAR(:new.apth,'YYYYMMHR24MISS')
    The full code would help a bit more.

  • How to load excel data into oracle table

    How do i load data from an excel file with several worksheets into an oracle table?
    using Oracle 10g
    Excel
    sample data of excel
    Name eric Name mary
    AccountNo 123 AccountNo 321
    amount1 5.0 Amount1 1.0
    amount2 5.5 Amount2 2.0
    amount3 6.0 Amount3 3.0
    Total 16.5 Total 6.0
    Name larry Name beth
    AccountNo 123 AccountNo 321
    amount1 5.0 Amount1 1.0
    amount2 5.5 Amount2 2.0
    amount3 6.0 Amount3 3.0
    Total 16.5 Total 6.0
    Note: Assume data are aligned into columns like a real excel workbook

    I have some used something like this.
    don't ask any details as I am not a xl person, but i think its pretty straight forword.
    hope its helpful for you or someone else
    Dim i As Integer
    Dim conn As New ADODB.Connection
    Dim strInsert As String
    Dim strExecInsert As String
    conn.ConnectionString = "Provider=MSDAORA.1;User ID=scott;password=tiger;Data Source=orcl.world;Persist Security Info=False"
    conn.Open
    strInsert = "insert into xlsc ( emp, dept, doj," & _
    "dol, dob, Ce ,ED, v_date ) values("
    'this is to insert first 2347 rows from xl to orcl
    While i < 2348
    strExecInsert = strInsert & "'" & _
    Trim(Cells(i, 1).Value) & "','" & _
    Trim(Cells(i, 2).Value) & "','" & _
    Trim(Cells(i, 3).Value) & "','" & _
    Trim(Cells(i, 4).Value) & "','" & _
    Trim(Cells(i, 5).Value) & "','" & _
    Trim(Cells(i, 6).Value) & "','" & _
    Trim(Cells(i, 7).Value) & "','" & _
    Trim(Cells(i, 8).Value) & "' )"
    'MsgBox strExecInsert
    If Cells(i, 1).Value <> "" Then
    conn.Execute (strExecInsert)
    End If
    i = i + 1
    Wend
    'conn.Execute ("commit")
    conn.Close
    End Sub

  • Help with truncating a table using plsql procedure in different schema

    I have a plsql procedure in schema A that truncates a table that is given in as parameter.
    create or replace procedure truncate_table(schema, table_name)
    EXECUTE IMMEDIATE 'TRUNCATE TABLE '||schema||'.'||table_name;
    end;
    The above procedure has public execute grant.
    I need to truncate a table in schema B. I have a plsql procedure in schema B that calls the truncate_table procedure and passes in the schema B table name.
    Since the table is in schema B, should the delete grant on the table be given to user A or user B to truncate the table in schema B?
    Thanks in advance.

    Procedure created in schema A
    create or replace
    procedure truncate_table(l_schema varchar2, table_name varchar2) authid current_user
    as
    begin
    EXECUTE IMMEDIATE 'TRUNCATE TABLE '||l_schema||'.'||table_name;
    end;from schema B
    grant delete on table1 to Schema_A
    from schema A
    exec truncate_table('Schema_B','Table1');
    Hope this helps.
    Alvinder

  • Update a table using plsql procedure

    Can any one help me to write a plsql procedure to update a table with new records and changes;
    Table rtest1 contains following records:
    deptno(number) deptname(varchar2(10)
    10 EWP
    20 PWD
    30 EPF
    Table rtest2 contains follwing records:
    deptno(number) deptname(varchar2(10)
    10 prod
    40 ops
    how to write a plsql procedure to to update table rtest2 using rtest1 data .

    use a merge statement, like this:
    SQL> create table rtest1
      2  as
      3  select 10 deptno, 'EWP' deptname from dual union all
      4  select 20, 'PWD' from dual union all
      5  select 30, 'EPF' from dual
      6  /
    Tabel is aangemaakt.
    SQL> create table rtest2
      2  as
      3  select 10 deptno, 'prod' deptname from dual union all
      4  select 40, 'ops' from dual
      5  /
    Tabel is aangemaakt.
    SQL> create procedure my_merge
      2  is
      3  begin
      4    merge into rtest2 r2
      5    using (select deptno, deptname from rtest1) r1
      6       on (r2.deptno = r1.deptno)
      7     when matched then
      8          update set deptname = r1.deptname
      9     when not matched then
    10          insert (deptno,deptname) values (r1.deptno,r1.deptname)
    11    ;
    12  end;
    13  /
    Procedure is aangemaakt.
    SQL> exec my_merge
    PL/SQL-procedure is geslaagd.
    SQL> select * from rtest2 order by deptno
      2  /
                                    DEPTNO DEPT
                                        10 EWP
                                        20 PWD
                                        30 EPF
                                        40 ops
    4 rijen zijn geselecteerd.Regards,
    Rob.

  • Uploading EXCEL file into Internal Table Using GUI_UPLOAD

    Can any one please give me an example use of FM "GUI_UPLOAD" which to upload a EXCEL file????? (not .txt)

    Use the forum search option [GUI_UPLOAD FOR EXCEL|https://forums.sdn.sap.com/search.jspa?threadID=&q=GUI_UPLOADFOREXCEL&objID=c42&dateRange=all&numResults=15&rankBy=10001]) or sdn wiki/code gallery ([UPLOAD EXCEL|https://wiki.sdn.sap.com/wiki/dosearchsite.action?searchQuery.queryString=upload+Excel&searchQuery.spaceKey=conf_global])  - Same question already answered many time
    GUI_UPLOAD doesnt perform such conversion (Excel, Word, PDF) and wont give you a suitable result, use one of the FM mentioned above or [office integration|http://help.sap.com/saphelp_47x200/helpdata/en/21/b53138e1ba11d2bdbe080009b4534c/frameset.htm] or OLE or convert your Excel sheet to a simpler format : txt, csv, xml.
    Regards,
    Raymond

  • Store XML data as relational data into Oracle tables using Java and XMLType

    I want to store xml data into an Oracle 11g table as relational storage, not as CLOB or Binary storage. Then I should also be able to query and fetch this data from table into an XML file.
    Any hint on how to write java code using XMLType to achieve this?
    Any help would be appreciated.

    Thanks for the explanation. I still have few confusions. I will try to elaborate my requirement with a simple example...
    I have the following xsd and xml files. "note" would be the table in database and "to", "from", "heading" and "body" would be the columns of note table. "Tove", "Jan", "Reminder" and "Don't forget me this weekend!" would go as data in one row of note table.
    How do I create note table with the xml schema (xsd file)?
    Should the note table be of XMLType or the columns?
    How do I load the XML data into the columns of note table?
    How do I retrieve the row of note table as XML file?
    XML Schema:
    <?xml version="1.0"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://www.xxxxx.com"
    xmlns="http://www.xxxxx.com"
    elementFormDefault="qualified">
    <xs:element name="note">
      <xs:complexType>
        <xs:sequence>
          <xs:element name="to" type="xs:string"/>
          <xs:element name="from" type="xs:string"/>
          <xs:element name="heading" type="xs:string"/>
          <xs:element name="body" type="xs:string"/>
        </xs:sequence>
      </xs:complexType>
    </xs:element>
    XML Data:
    <?xml version="1.0"?>
    <note>
      <to>Tove</to>
      <from>Jan</from>
      <heading>Reminder</heading>
      <body>Don't forget me this weekend!</body>
    </note>

  • Using Oracle Forms Importing Data From SQL Server into Oracle Tables.

    Dear All,
    We are using Oracle Forms 10g in windows XP and having OAS 10g and Oracle database 9i.
    How can we import data from SQL Server 2005 into Oracle tables using Oracle Forms?
    Thanks & Regards
    Eidy

    I have no idea what "Oracle Hetrogenius Services" is, so I can't help you with that, sorry.
    SQL Developer might also assist you. SQL Developer can connect to SQL Server as well as Oracle and has some tools for migration. See the documentation for details:
    http://download.oracle.com/docs/cd/E12151_01/doc.150/e12156/toc.htm
    For additional help on using SQL Developer for this task, please consult Support or the SQL Developer forum: SQL Developer
    Hope this helps,
    Jacob

  • Unable to load excel sheet into oracle

    Can somebody help me...
    I just want to load data records from MS Excel spreadsheet into Oracle table without converting that MS Excel file,
    my ENV: Linux (centos 5.4 + Oracle EE 11gR2)
    here what I did:
    -ODBC-Conf on MS
    create a system DSN 'odbc_excel' => OK
    -Create HS initialization File => OK
    cat initexcel.ora
    HS_FDS_CONNECT_INFO = odbc_excel
    HS_AUTOREGISTER = TRUE
    HS_DB_NAME = dg4odbc
    -Modify listener.ora => OK
    SID_LIST_LISTENER =
    (SID_LIST =
    (SID_DESC =
    (SID_NAME = excel)
    (ORACLE_HOME = /home/oracle/app/oracle/product/11.2.0/dbhome_1)
    (PROGRAM = dg4odbc)
    (SID_DESC =
    (SID_NAME = PLSExtProc)
    (ORACLE_HOME = /home/oracle/app/oracle/product/11.2.0/dbhome_1)
    (PROGRAM = extproc)
    -Modify tnsnames.ora: => OK
    excel =
    (DESCRIPTION =
    (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = DEDUSOBI)(PORT = 1521)))
    (CONNECT_DATA = (SID = excel)) (HS = OK)
    -lsnrctl reload => OK
    LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 11-MAR-2010 13:15:32
    Copyright (c) 1991, 2009, Oracle. All rights reserved.
    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
    The command completed successfully
    -tnsping excel => OK
    TNS Ping Utility for Linux: Version 11.2.0.1.0 - Production on 11-MAR-2010 13:15:09
    Copyright (c) 1997, 2009, Oracle. All rights reserved.
    Used parameter files:
    /home/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/sqlnet.ora
    Used TNSNAMES adapter to resolve the alias
    Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = DEDUSOBI)(PORT = 1521))) (CONNECT_DATA = (SID = excel)) (HS = OK))
    OK (20 msec)
    -create link in ORA => OK
    SQL> create database link excel using 'excel';
    Database link created.
    SQL> select * from dba_db_links where DB_LINK like '%EXCEL%';
    OWNER SYSTEM
    DB_LINK EXCEL
    USERNAME
    HOST excel
    CREATED 11-Mar-10
    -check link => NOK :-(
    SQL> select table_name from all_tables@EXCEL;
    ERROR at line 1:
    ORA-28500: connection from ORACLE to a non-Oracle system returned this message:
    ORA-02063: preceding line from EXCEL
    -listener.log
    11-MAR-2010 13:33:30 * (CONNECT_DATA=(SID=excel)(CID=(PROGRAM=)(HOST=DEDUSOBI)(USER=oracle))) * (ADDRESS=(PROTOCOL=tcp) (HOST=127.0.0.1)(PORT=58093)) * establish * excel * 0
    All comments are welcome, thanks
    Zeynel
    Edited by: seyrekel on Mar 11, 2010 4:07 AM

    thanks for the respond Werner, that seems to be the most tricky part (ODBC-Conf@Linux)
    the driver should be available:
    # rpm -qa | grep -i odbc
    unixODBC-devel-2.2.11-7.1
    unixODBC-2.2.11-7.1
    # odbcinst -j
    unixODBC 2.2.11
    DRIVERS............: /etc/odbcinst.ini
    SYSTEM DATA SOURCES: /etc/odbc.ini
    USER DATA SOURCES..: /root/.odbc.ini
    #file /.../dbhome_1/bin/dg4odbc
    /.../dg4odbc:
    ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV),
    for GNU/Linux 2.6.9, dynamically linked (uses shared libs),
    for GNU/Linux 2.6.9, not stripped
    # odbcinst -s -q
    [ODBC]
    [AnalyticsWeb]
    [Cluster]
    [SSL_Sample]
    but still the same error message...
    thanks
    Zeynel

Maybe you are looking for