Jython error while updating a oracle table based on file count

Hi,
i have jython procedure for counting counting records in a flat file
Here is the code(took from odiexperts) modified and am getting errors, somebody take a look and let me know what is the sql exception in this code
COMMAND on target: Jython
Command on source : Oracle --and specified the logical schema
Without connecting to the database using the jdbc connection i can see the output successfully, but i want to update the oracle table with count. any help is greatly appreciated
---------------------------------Error-----------------------------
org.apache.bsf.BSFException: exception from Jython:
Traceback (innermost last):
File "<string>", line 45, in ?
java.sql.SQLException: ORA-00936: missing expression
---------------------------------------Code--------------------------------------------------
import java.sql.Connection
import java.sql.Statement
import java.sql.DriverManager
import java.sql.ResultSet
import java.sql.ResultSetMetaData
import os
import string
import java.sql as sql
import java.lang as lang
import re
filesrc = open('c:\mm\xyz.csv','r')
first=filesrc.readline()
lines = 0
while first:
#get the no of lines in the file
lines += 1
first=filesrc.readline()
#print lines
## THE ABOVE PART OF THE PROGRAM IS TO COUNT THE NUMBER OF LINES
## AND STORE IT INTO THE VARIABLE `LINES `
def intWithCommas(x):
if type(x) not in [type(0), type(0L)]:
raise TypeError("Parameter must be an integer.")
if x < 0:
return '-' + intWithCommas(-x)
result = ''
while x >= 1000:
x, r = divmod(x, 1000)
result = ",%03d%s" % (r, result)
return "%d%s" % (x, result)
## THE ABOVE PROGRAM IS TO DISPLAY THE NUMBERS
sourceConnection = odiRef.getJDBCConnection("SRC")
sqlstring = sourceConnection.createStatement()
sqlstmt="update tab1 set tot_coll_amt = to_number( "#lines ") where load_audit_key=418507"
sqlstring.executeQuery(sqlstmt)
sourceConnection.close()
s0=' \n\nThe Number of Lines in the File are ->> '
s1=str(intWithCommas(lines))
s2=' \n\nand the First Line of the File is ->> '
filesrc.seek(0)
s3=str(filesrc.readline())
final=s0 + s1 + s2 + s3
filesrc.close()
raise final

i changed as you adviced ankit
am getting the following error now
org.apache.bsf.BSFException: exception from Jython:
Traceback (innermost last):
File "<string>", line 37, in ?
java.sql.SQLException: ORA-00911: invalid character
here is the modified code
sourceConnection = odiRef.getJDBCConnection("SRC")
sqlstring = sourceConnection.createStatement()
sqlstmt="update tab1 set tot_coll_amt = to_number('#lines') where load_audit_key=418507;"
result=sqlstring.executeUpdate(sqlstmt)
sourceConnection.close()
Any ideas
Edited by: Sunny on Dec 3, 2010 1:04 PM

Similar Messages

  • Error while updating default media player for audio files??

    Ever since I received a replacement iPod Nano for my original through the AppleCare program, I frequently get the following message while syncing podcasts:
    "An error occurred while updating the default player for audio file types. You do not have enough access privileges for this operation."
    How can I correct this problem?
    HP Pavilion zv6000   Windows XP   Athlon 64 Processor 4000+

    Check out this thread for a possible resolution to your problem: http://discussions.apple.com/message.jspa?messageID=6825681

  • Column not found error while populatin a oracle table with ODI USer

    Hi,
    I am trying to populate a column in a oracle table with the ODI USER name using the function getUser("USER_NAME") in the Mapping column of the Interface, But the interface throwhing an error *Column not found : Supervisor in Statement [Select......]*. but it's working fine with getUser("I_USER') the column is populating the user identifier.
    can any one help me out why user is not populating.
    Thanks

    Enclose the call to the getUser api inside single quotes
    '<%=getUser("USER_NAME")%>'ID being a number can be used directly but USER_NAME returns a string that needs to be quoted

  • Regardig error while updating the database table

    hi experts,
       i m trying to update the database table from the values containig in my internal table  ,,,but the system is giving this error plz help me::::
    The type of the database table and work area (or internal table)
    "ITAB_UPDATE" are not Unicode convertible. Unicode convertible.          
    my internal table name itab_update and the database table name yitab.i m using this statement::
        modify yitab from itab_update.

    Hi
    1. You  have to Declare the Itab with the same structure as DB table.
    2. Use the statement
        Modify <DBtable> from TABLE <itab>.
    or
       Update <DBtable> from TABLE <itab>.
    Hope this will solve.
    Reward .....if so.
    Regards.

  • Error while loading data oracle table using xslt

    Hi
    I have an following xml:
    <TRAN TRAN_ID = "12" RCODE = "W"> <STATION>1234567</STATION> </TRAN>
    I have created the following xslt for the above xml:
    <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="TRAN"><xsl:value-of select="@TRAN_ID" /> <xsl:value-of select="@RCODE" /> </xsl:template> </xsl:stylesheet>
    I am trying to insert data into the table Tran having columns tran_id and rcode in oracle database 11g.
    I am getting the following error:
    ERROR at line 1:
    ORA-31011: XML parsing failed
    ORA-19202: Error occurred in XML processing
    LPX-00210: expected '<' instead of '1'
    ORA-06512: at "SYS.DBMS_XMLSTORE", line 78
    ORA-06512: at "SYS.DBMS_XMLSTORE", line 88
    Can anybody tell me if i am making a mistake in writing the xlst?
    Thanks in advance.

    Thank you for your reply. Currently i am using the insert using xmltable and it works fine. But i would like to use xsl if the dynamic passing of values is possible. Actually i want to store the xsl in a table and call it when needed to insert data to the database table (MSGS). Could you please give me an example of it?
    Here is the table structure i have in database:
    Table Name: Tran_data
    columns: SEQ NUMBER NOT NULL ,
    TRAN_ID VARCHAR2(6) NOT NULL ,
    RCODE VARCHAR2(30) NOT NULL ,
    TRAN_DT DATE NOT NULL ,
    xml_data xmltype
    Table Name : Msgs
    SEQ NUMBER NOT NULL,
    RULE_ID VARCHAR2(200) not null,
    MSG_TXT VARCHAR2(2000) NOT NULL,
    TRAN_DATA_SEQ NUMBER NOT NULL ,
    CREATE_USER VARCHAR2(30) NOT NULL ,
    CREATE_DATE DATE NOT NULL ,
    COMMENTS VARCHAR2(2000)
    In this TRAN_DATA_SEQ is a foreign key and is a mandatory column. I can get the Tran_id and the rcode from xml. but the remaining mandatory columns i need to pass them to the xsl. Below is the xsl. Can you please let me know how to pass value to this the xsl.
    [P]
    xml:
    <RES>
    <Status>'PASS'</Status>
    <Tran_id>1A</Tran_id>
    <Rcode>1BR</Rcode>
    <Msg>
    <Rule_Id>A<Rule_Id>
    <Msg_Text>'CRDT Failed'<Msg_Text>
    </Msg>
    <Msg>
    <Rule_Id>B<Rule_Id>
    <Msg_Text>'MAN Failed'<Msg_Text>
    </Msg>
    </RES>
    [P]
    I need an xsl for this xml to insert tran_id and rcode in tran_data table along with the xml as xml_data and the msg information in msgs table. The seq of tran_data needs to be inserted into the msgs table. Please let me know how this can be achieved using xsl?
    Thanks in advance.

  • Error while updating custom db table with internal table

    Hi experts,
    My question is : I define a itable like
    types begin of ty_data,
            f1(3)  type  c,
            f2(4)  type  c,
           end of ty_data.
    data itab type standard table of  ty_data.
    and my custom table(YDATA) is also same structure of  itab.
    then  I use insert statement like this
    loop at itab into wa_data.
      INSERT into YDATA values wa_data.
    endloop.
    my problem is I get  an error like this
    The type of the database table and work area (or internal table)          
    "wa_data" are not Unicode-convertible . . . . . . . . . .     
    please give me the solution for this error.
    Thanks     
    durga prasad

    Please post ABAP-questions in one of the <a href="https://forums.sdn.sap.com/index.jspa#42">ABAP forums</a>.
    My small addition to the existing hints: define the work area using LIKE LINE OF, the LIKE keyword is a very nice way of ensuring that data types match. You can reference input parameters, other locally defined variables and more.
    DATA: t_ydata TYPE STANDARD TABLE OF ydata,
          l_ydata LIKE LINE OF t_ydata[].

  • AD Administration error: aijmgrStoreNodeName:Error while updating FND_INSTA

    Hi
    While applying a patch i am receiving the following:
    Starting worker processes.
    AutoPatch error:
    aijmgrStoreNodeName:Error while updating FND_INSTALL_PROCESSES
    AutoPatch error:
    ORA-01403: no data found
    AutoPatch error:
    Error: Calling aijmgrStoreNodeName():aijms1
    Error running SQL and EXEC commands in parallel
    I am on 11.5.10.2 wtih DB at 10.2.0.4.
    Thanks.

    AutoPatch error:
    aijmgrStoreNodeName:Error while updating FND_INSTALL_PROCESSESDrop this table and apply the patch from the beginning.
    AutoPatch error:
    ORA-01403: no data found
    AutoPatch error:
    Error: Calling aijmgrStoreNodeName():aijms1Can you reproduce the issue if you apply any of the patches individually?
    Thanks,
    Hussein

  • Error while updating JDBD table

    Hi all,
    Am getting the error at the receiver JDBC CC. I have checked the conceren mapping also . i t is working under test tab.
    Error while parsing or executing XML-SQL document: Error processing request in sax parser: Error when executing statement for table/stored proc. 'SAP_STG_AP_SAP_REF' (structure 'Statement'): com.sybase.jdbc3.jdbc.SybSQLException: Attempt to insert duplicate key row in object 'SAP_STG_AP_SAP_REF' with unique index 'SAP_STG_AP_SAP_REF_IX1'
    Any sugestion?
    Thanks,
    kanan

    ya issue is while updating the jdbc table ..duplicate entries are coming...I have check the maping xml also with the same data..I think I need to change the mapping -to remove the duplicate (entry in that field) using some function. Any idea which will be the function?? + please let me know how to find out which field is the error refering to in the jdbc table-- with unique index 'SAP_STG_AP_SAP_REF_IX1'
    In my scenario Action is INSERT. At the mapping output, there are some entries (5-6 ACCESS) where all the fields under the ACCESS are similar
    kanan

  • Error while using Oracle Table as source file :- ODQ for ODI

    Hi All,
    I am getting some errors while working on ODQ with Oracle Tables as source file.
    If I am trying with text files (*.txt) as source and output it works fine.
    Please let me know how we can connect to an oracle table which is my source file.
    In the exported project -> “settings” folder
    In the file named eN_transfmr_pXX.stx
    For
    /CATEGORY/INPUT/PARAMETER/INPUT_SETTINGS/ARGUMENTS/EN
    TRY/DATA_FILE_NAME=
    What I need to give? (URL – source file)
    I tried with
    1. jdbc:oracle:thin:@xxx.xxx.x.xx:1521:ORCL
    2. jdbc:oracle:thin:UserName/Password@// xxx.xxx.x.xx:1521:ORCL
    i am not sure , is there any thing missing ???
    (Note: for text file I am giving “D:\Sourcefolder\customer.txt”)
    If I am running the batch file directly from CMD Prompt it’s displaying the error message
    “Cannot open file”
    If I am connecting with ODI it’s displaying the error
    com.sunopsis.dwg.function.SnpsFunctionBaseException: OS command returned 3503. …………………….
    Thanks in advance…
    Rathish A M

    Hi Ratish,
    ODQ supports files as inputs not Oracle tables, what you should do is:
    - define an ODQ process that takes a file as an input.
    - create an ODI process that dumps your Oracle table into a file that will be used by ODQ. (interface or OdiSqlUnload step)
    - run the ODQ process in ODI (in a package)
    - create an ODI interface that will load your ODQ output file into a DB.
    You can profile Oracle tables directly using Oracle Data Profiling.
    Thanks,
    Julien

  • Get Error while update the User defined row table through DSK Code

    Hi experts,
    I have got an error while updating the user row defined table.
    Error is - "Invalid row"
    I have created one master table "@CBF_FARM " and Child table "@CBF_FAR1"
    First i inserted 5 record in the child table so in my my child table there are 5 Line id (1,2,3,4,5 one for each row).
    after that i delete 2 rows (3rd & 4th row) from child table now in my child table there are 3 rows( Line id 1, 2, 5). Please See attachment.
    Now i am updating  the last record of child table through Code  (Line id is 5)  from other form, then i got error  invalid row.
    Following Code used for updating the user defined child table.
      SAPbobsCOM.GeneralService oGeneralService1 = null;
                                    SAPbobsCOM.GeneralData oGeneralData1 = null;
                                    SAPbobsCOM.GeneralDataParams oGeneralParams1 = null;
                                    SAPbobsCOM.CompanyService sCmp1 = null;
                                    SAPbobsCOM.GeneralData oChild1 = null;
                                    SAPbobsCOM.GeneralDataCollection oChildren1 = null;
                                    sCmp1 = clsAddOn.LDNA_Company.GetCompanyService();
                                    oGeneralService1 = sCmp1.GetGeneralService("CBF_FARM");
                                    // Get UDO record
                                    oGeneralParams1 = ((SAPbobsCOM.GeneralDataParams)(oGeneralService1.GetDataInterface(SAPbobsCOM.GeneralServiceDataInterfaces.gsGeneralDataParams)));
                                    oGeneralParams1.SetProperty("Code", oForm.Items.Item("edtFarmCd").Specific.Value);
                                    oGeneralData1 = oGeneralService1.GetByParams(oGeneralParams1);
                                    // Add lines on UDO Child Table
                                    oChildren1 = oGeneralData1.Child("CBF_FAR1");
                                    // Create data for rows in the child table
                                    SAPbouiCOM.Item oItem = oForm.Items.Item("cmbShed");
                                    oCombo = oItem.Specific;
                                    string ShedCode = oCombo.Selected.Value;
                                    ldna_Rec = clsAddOn.LDNA_Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
                                    string strQuery1 = "select LineId from [@CBF_FAR1] where U_ShedCd = " + ShedCode;
                                    ldna_Rec.DoQuery(strQuery1);
                                    oChild1 = oChildren1.Item(ldna_Rec.Fields.Item("LineId").Value - 1);
                                    oChild1.SetProperty("U_Status", "Ready For Schedule");
                                    //Update the UDO Record
                                    oGeneralService1.Update(oGeneralData1);
    Please Help me it is an urgent requirement,
    -Regards
    Vikas

    hi.
    Error is - "Invalid row"
    Now i am updating  the last record of child table through Code  (Line id is 5)  from other form, then i got error  invalid row.
    As per my knowledge
    What i understood is you have 5 lines and you are going to be update 5th line
    am i correct..
    while u are updating the line in child table
    you have to consider like this..
    line number         u have to update like
    1                                        0
    2                                        1
    3                                        2
    4                                        3
    5                                        4
    which means in child table treat
    line 1  as 0
    line 2 as  1
    line 5 as 4
    If you want to update the line 5 u have to mention 4 th line

  • Error while updating the records through a DB link

    Hi ,
    I am getting the below error while updating around 15 thousands records, i suspect it to be timeout but not sure.Please can you let me know what solutions needs to be taken.
    Not Found
    The requested URL /pls/htmldb/wwv_flow.show was not found on this server.
    Not Found
    The requested URL /pls/htmldb/wwv_flow.show was not found on this server.
    Oracle-Application-Server-10g/10.1.2.0.0 Oracle-HTTP-Server Server at htmldb.oraclecorp.com Port 80
    Object Type TABLE Object GWB_GRN_GRP_COUNTRIES_LU
    Table Column Data Type Length Precision Scale Primary Key Nullable Default Comment
    GWB_GRN_GRP_COUNTRIES_LU NAME Varchar2 720 - - - - - -
    ALIAS Varchar2 720 - - - - - -
    ACTIVE Varchar2 3 - - - - - -
    REGION Varchar2 300 - - - - -
    1 - 4
    Thanks & Regards,
    Ramu

    Hi Sangu,
    See if the following notes help you:
    Error when calling API from SQL*Developer, eg. ORA-01403 in API OE_ORDER_PUB.PROCESS_ORDER (Doc ID 1054295.1)
    Cancellation Of Transfer Orders Is Not Possible - ORA-01403: no data found in Package OE_Order_PVT Procedure Process_Order (Doc ID 391307.1)
    Thanks &
    Best Regards,

  • There was an error while updating row count for "SH".."SH".CHANNELS

    Hi All,
    Am new to OBIEE.Pls help in this regard.
    Am building the physical layer as per Repository guide.When am importing the data in to this,am getting the below error.
    *"There was an error while updating row count for "SH".."SH".CHANNELS" :"*
    channles is the table name and having 5 rows.
    but am able to see the data in the sql prompt. like SELECT * FROM SH.CHANNELS then 5 rows data would be displaying..
    pls help in this regard and where is the excat problem?
    Thanks,

    what is the error?
    Make sure that your connection pool settings are okay..
    Make sure that, you are using correct driver in case of if you are using ODBC dsn..
    Also make sure that, your oracle server is running... TNS and Oracle server services

  • Error while updating a plan

    Hi,
    I have encountered an error while updating a plan. While i update the uplan , the grid gets filled but it throws a message stating
    "Maximum Number of Result Blocks has been reached"
    Maximum number of Result Blocks has been reached.
    [Oracle BAM Enterprise Link error code:  DC -- 0x1, DC -- 0xD4]
    Error while processing the data for the step 'Grid'
    [Oracle BAM Enterprise Link error code:  DC -- 0x1, DC -- 0x83]
    Maximum number of Result Blocks has been reached.
    [Oracle BAM Enterprise Link error code:  DC -- 0x1, DC -- 0xD4]
    Error while processing the data for the step 'Grid'
    [Oracle BAM Enterprise Link error code:  DC -- 0x1, DC -- 0x83]
    Update of Plan "deposittest created 7/19/2007 5:11:50 PM" failed.
    [Oracle BAM Enterprise Link error code:  PlanMgr -- 0x1, PlanMgr -- 0xD5]
    The data updation stops after the row count 49900.
    Please help to resolve this error .
    Thanks in advance.
    Regards,
    Lathika

    Hi,
    in BAM-Administrator you should rraise Parameter "MaxResultBlocks".
    BAM originaly is al licensed Software from Group1 named "Sagent Data Flow".
    This may help searching the web.
    Greetz,
    GOI

  • Error while creating the DWH tables using DAC

    Hi,
    I am getting error while creating the DWH tables using DAC. I have created a ODBC DSN using merant driver with DAC repository DB credentials and the test connection is successful. And while creating the tables i gave the olap dw credentials and the DSN name which i created earlier. But it throws the error as below:
    Please find the below mentioned error message
    =====================================
    STD OUTPUT
    =====================================
    CREATING SIEBEL DATABASE OBJECTS
    F:\DAC\bifoundation\dac\UTILITIES\BIN\DDLIMP /I N /s N /u infdomain /p ******* /c DB_DAC /G "SSE_ROLE" /f F:\DAC\bifoundation\dac/conf/sqlgen/ctl-file/oracle_bi_dw.ctl /b "" /K "" /X "" /W N
    Error while importing Siebel database schema.
    =====================================
    ERROR OUTPUT
    =====================================
    Siebel Enterprise Applications ODBC DDL Import Utility, Version 7.7 [18030] ENU
    Copyright (c) 2001 Siebel Systems, Inc. All rights reserved.
    This software is the property of Siebel Systems, Inc., 2207 Bridgepointe Parkway,
    San Mateo, CA 94404.
    User agrees that any use of this software is governed by: (1) the applicable
    user limitations and other terms and conditions of the license agreement which
    has been entered into with Siebel Systems or its authorized distributors; and
    (2) the proprietary and restricted rights notices included in this software.
    WARNING: THIS COMPUTER PROGRAM IS PROTECTED BY U.S. AND INTERNATIONAL LAW.
    UNAUTHORIZED REPRODUCTION, DISTRIBUTION OR USE OF THIS PROGRAM, OR ANY PORTION
    OF IT, MAY RESULT IN SEVERE CIVIL AND CRIMINAL PENALTIES, AND WILL BE
    PROSECUTED TO THE MAXIMUM EXTENT POSSIBLE UNDER THE LAW.
    If you have received this software in error, please notify Siebel Systems
    immediately at (650) 295-5000.
    F:\DAC\bifoundation\dac\UTILITIES\BIN\DDLIMP /I N /s N /u infdomain /p ***** /c DB_DAC /G SSE_ROLE /f F:\DAC\bifoundation\dac/conf/sqlgen/ctl-file/oracle_bi_dw.ctl /b /K /X /W N
    Connecting to the database...
    28000: [DataDirect][ODBC Oracle driver][Oracle]ORA-01017: invalid username/password; logon denied
    Unable to connect to the database...
    any help is appreciated.
    Thanks,
    RM

    The fact that you are getting an "ORA-01017: invalid username/password; logon denied" message indicates that you are at least talking to the database.
    The log shows that username "infdomain" is being used. Can you double check the username and password you have in DAC in a SQL*Plus/SQL Developer session?
    Please mark if useful/helpful,
    Andy.

  • Error while updating to target

    Hi Friends,
    Im trying to load the data from the DSO to the cube, while loading the data im getting a error "Error while updating to target CUBE Name".
    when i check the message in error stack im getting this "Value 'Complaints Resolution for Activity ' (hex. '0043006F006D0070006C00610069006E007400730020005200') of characteristic ZWF_NAME BRAIN 60"
    I found a notEe 1148007, this not says that
    "A program to write data is generated for each InfoCube that contains data (type "Standard"). The name of this program is stored in the table RSDCUBELOC.  When you activate an InfoCube again, the name of this program may inadvertently be deleted.
    In the DTP monitor, this error occurs in the "Update" step and message RSBK 241 is displayed: "Error while updating to target G7SD0C05 (type INFOCUBE)"
    I have checked the table RSDCUBELOC and i can see the program entry there and after that i have reactivated the cube and reloaded the data but im still getting the same issue.
    Can anyone pls suggest me how to resolve this issue?.
    Thanks in advance
    BN

    Hi,
    It is issue with the Lowe case letters of a particular info object.  You have to write a routine to convert those lower into upper.
    reason is if you chack IOB properties Lower case might be unchecked and the data you are getting in lower case.
    Let us know the details if you still have any issues.
    Reg
    Pra

Maybe you are looking for

  • Need advice on how to export ALL images including any changes (Versions)

    I have well over 15000 RAW ORF Olympus images in Aperture with approximately 10000 of them in the database and the rest as references to the file on the file system. My problem is 'many' fold... First I am frustrated with using Aperture only because

  • HT1551 I'm able to watch netflix's for about 15 minutes then the video goes black but I still have audio.

    I just set up my Apple TV. I'm able to watch netflix's for about 15 minutes then the video goes black but I still have audio.

  • Freezing Up Problem with 2G Nano 8gb

    My 2G Nano 8gb freezes up at least once to twice ever 2 weeks. This began happening when I bought it. After charging and disconnecting, when I try to play a track it just freezes up. I usually hold select and menu to restart. I tried a system restore

  • View Memo option in UWL

    Hello, I am trying to include the "View Memo" option for a couple of different work items in UWL under the "You can also" section. The View Memo shows up fine for one work item and doesn't show up for the other. However I have similar UWL configurati

  • Movie By Frame - AVI/MPG

    Hi there, I have problem getting a valid FrameGrabbingControl and valid FramePositioningControl. I've tried many examples. I need to create MoviePlayer with ability to play movie by single frame, but every time when I try to get: FrameGrabbingControl