Dynamic update in Oracle 9i Release 9.2

Hi all,
The update statement I want to execute depends on three variables. The statement is like this :
update fichier_tempo
               set flag = 0
               where substr(texte,7,2) = pcode_enreg
               and flag = 1
               and v_id = vcode;
In this statement : pcode_enreg , v_id and vcode are variables.
The statement may affect many rows.
I have already thought about using the execute immediate statement but it requires that the update affects only one row with the returning into clause.
So how to execute this dynamic update ?
Thank you very much indeed.

You have lots of errors in that code.
One of them is indeed the dynamic update where you say that the string "substr(texte,20,13)" should be equal to the string that's in vcode (in my example below: abcdefghijklm). This is probably not what you want.
First I'll show you a variant of your code, which lots of areas in it to improve on, but hey: it works ;-)
Then I'll show you one merge statement that does it all in once.
Hope it helps.
SQL> create table fichier_tempo
  2  as
  3  select 'xxxxxx50xxxxxxxxxxxabcdefghijklm' texte, 1 flag, 5 num from dual union all
  4  select 'xxxxxx50xxxxxxxxxxxabcdefghijklm', 1, 4 from dual union all
  5  select 'xxxxxx50xxxxxxxxxxxabcdefghijklm', 0, 3 from dual union all
  6  select 'xxxxxx50xxxxxxxxxxxabcdefghijklm', 1, 2 from dual union all
  7  select 'xxxxxx53xxxxxxxxxxxzyxwvutsrqpon', 0, 11 from dual union all
  8  select 'xxxxxx53xxxxxxxxxxxzyxwvutsrqpon', 1, 12 from dual union all
  9  select 'xxxxxx53xxxxxxxxxxxzyxwvutsrqpon', 0, 13 from dual
10  /
Tabel is aangemaakt.
SQL> create or replace procedure p_test397(pcode_enreg varchar2)
  2  is
  3    --vmotif conrej_fic.crf_lib_err%type := get_motif_rejet('397');
  4    v_id varchar2(40);
  5    vsql varchar2(4000);
  6    c_div sys_refcursor;
  7    vcode varchar2(13);
  8    nb number;
  9    vsql_div varchar2(4000);
10    updt_div sys_refcursor;
11  begin
12    select case pcode_enreg
13    when '50' then 'substr(texte,20,13)'
14    when '53' then 'substr(texte,20,4)'
15    when '56' then 'substr(texte,20,4)'
16    end
17    into v_id
18    from dual;
19
20    vsql := 'select '||v_id||',count(*) '||
21    'from fichier_tempo '||
22    'where flag = 1 '||
23    'and substr(texte,7,2) = '||pcode_enreg||' '||
24    'and num > 0 '||
25    'having count(*) > 1 '||
26    'group by '||v_id;
27
28    open c_div for vsql;
29
30    loop
31      fetch c_div into vcode,nb;
32      exit when c_div%notfound;
33
34      -- This is the dynamic update
35      execute immediate
36      'update fichier_tempo ' ||
37      'set flag = 0 ' ||
38      'where substr(texte,7,2) = ' || pcode_enreg || ' ' ||
39      'and flag = 1 ' ||
40      'and '||v_id||' = '''||vcode||''''
41      ;
42    end loop;
43    close c_div;
44  end;
45  /
Procedure is aangemaakt.
SQL> select * from fichier_tempo
  2  /
TEXTE                                                              FLAG                                 NUM
xxxxxx50xxxxxxxxxxxabcdefghijklm                                      1                                   5
xxxxxx50xxxxxxxxxxxabcdefghijklm                                      1                                   4
xxxxxx50xxxxxxxxxxxabcdefghijklm                                      0                                   3
xxxxxx50xxxxxxxxxxxabcdefghijklm                                      1                                   2
xxxxxx53xxxxxxxxxxxzyxwvutsrqpon                                      0                                  11
xxxxxx53xxxxxxxxxxxzyxwvutsrqpon                                      1                                  12
xxxxxx53xxxxxxxxxxxzyxwvutsrqpon                                      0                                  13
7 rijen zijn geselecteerd.
SQL> exec p_test397('50')
PL/SQL-procedure is geslaagd.
SQL> select * from fichier_tempo
  2  /
TEXTE                                                              FLAG                                 NUM
xxxxxx50xxxxxxxxxxxabcdefghijklm                                      0                                   5
xxxxxx50xxxxxxxxxxxabcdefghijklm                                      0                                   4
xxxxxx50xxxxxxxxxxxabcdefghijklm                                      0                                   3
xxxxxx50xxxxxxxxxxxabcdefghijklm                                      0                                   2
xxxxxx53xxxxxxxxxxxzyxwvutsrqpon                                      0                                  11
xxxxxx53xxxxxxxxxxxzyxwvutsrqpon                                      1                                  12
xxxxxx53xxxxxxxxxxxzyxwvutsrqpon                                      0                                  13
7 rijen zijn geselecteerd.
SQL> exec p_test397('53')
PL/SQL-procedure is geslaagd.
SQL> select * from fichier_tempo
  2  /
TEXTE                                                              FLAG                                 NUM
xxxxxx50xxxxxxxxxxxabcdefghijklm                                      0                                   5
xxxxxx50xxxxxxxxxxxabcdefghijklm                                      0                                   4
xxxxxx50xxxxxxxxxxxabcdefghijklm                                      0                                   3
xxxxxx50xxxxxxxxxxxabcdefghijklm                                      0                                   2
xxxxxx53xxxxxxxxxxxzyxwvutsrqpon                                      0                                  11
xxxxxx53xxxxxxxxxxxzyxwvutsrqpon                                      1                                  12
xxxxxx53xxxxxxxxxxxzyxwvutsrqpon                                      0                                  13
7 rijen zijn geselecteerd.
SQL> rollback
  2  /
Rollback is voltooid.
SQL> create procedure mytest397 (pcode_enreg in varchar2)
  2  is
  3  begin
  4    merge into fichier_tempo f1
  5    using ( select a, rid
  6              from ( select count(*) over
  7                            ( order by
  8                                case pcode_enreg
  9                                when '50' then substr(texte,20,13)
10                                when '53' then substr(texte,20,4)
11                                when '56' then substr(texte,20,4)
12                                end
13                            ) a
14                          , rowid rid
15                       from fichier_tempo
16                      where flag = 1
17                        and num > 0
18                        and substr(texte,7,2) = pcode_enreg
19                   )
20             where a > 1
21          ) f2
22    on (f1.rowid = f2.rid)
23    when matched then
24      update set flag = 0
25    when not matched then
26      insert values (null,null,null)  -- dummy line for version 9i
27    ;
28  end;
29  /
Procedure is aangemaakt.
SQL> select * from fichier_tempo
  2  /
TEXTE                                                              FLAG                                 NUM
xxxxxx50xxxxxxxxxxxabcdefghijklm                                      1                                   5
xxxxxx50xxxxxxxxxxxabcdefghijklm                                      1                                   4
xxxxxx50xxxxxxxxxxxabcdefghijklm                                      0                                   3
xxxxxx50xxxxxxxxxxxabcdefghijklm                                      1                                   2
xxxxxx53xxxxxxxxxxxzyxwvutsrqpon                                      0                                  11
xxxxxx53xxxxxxxxxxxzyxwvutsrqpon                                      1                                  12
xxxxxx53xxxxxxxxxxxzyxwvutsrqpon                                      0                                  13
7 rijen zijn geselecteerd.
SQL> exec mytest397('50')
PL/SQL-procedure is geslaagd.
SQL> select * from fichier_tempo
  2  /
TEXTE                                                              FLAG                                 NUM
xxxxxx50xxxxxxxxxxxabcdefghijklm                                      0                                   5
xxxxxx50xxxxxxxxxxxabcdefghijklm                                      0                                   4
xxxxxx50xxxxxxxxxxxabcdefghijklm                                      0                                   3
xxxxxx50xxxxxxxxxxxabcdefghijklm                                      0                                   2
xxxxxx53xxxxxxxxxxxzyxwvutsrqpon                                      0                                  11
xxxxxx53xxxxxxxxxxxzyxwvutsrqpon                                      1                                  12
xxxxxx53xxxxxxxxxxxzyxwvutsrqpon                                      0                                  13
7 rijen zijn geselecteerd.
SQL> exec mytest397('53')
PL/SQL-procedure is geslaagd.
SQL> select * from fichier_tempo
  2  /
TEXTE                                                              FLAG                                 NUM
xxxxxx50xxxxxxxxxxxabcdefghijklm                                      0                                   5
xxxxxx50xxxxxxxxxxxabcdefghijklm                                      0                                   4
xxxxxx50xxxxxxxxxxxabcdefghijklm                                      0                                   3
xxxxxx50xxxxxxxxxxxabcdefghijklm                                      0                                   2
xxxxxx53xxxxxxxxxxxzyxwvutsrqpon                                      0                                  11
xxxxxx53xxxxxxxxxxxzyxwvutsrqpon                                      1                                  12
xxxxxx53xxxxxxxxxxxzyxwvutsrqpon                                      0                                  13
7 rijen zijn geselecteerd.Regards,
Rob.

Similar Messages

  • How to update for oracle Release 10.2.0.1 to 10.2.0.3

    Hi,
    Can anybody give me hint how can i update my oracle version 10.2.0.1 to version 10.2.0.3.
    I have installed oracle 10gR2 with following:
    SQL> select * from v$version;
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
    PL/SQL Release 10.2.0.1.0 - Production
    CORE     10.2.0.1.0     Production
    TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production
    Now how to update to Release 10.2.0.3 - Prod
    Regards,
    Rushang

    Download it as a patch from Metalink.
    If you have Vista, go to http://www.oracle.com/technology/software/products/database/oracle10g/htdocs/10203vista.html
    You will normally follow the upgrade guide that comes with the download. It is simple to follow.

  • Oracle Critical Patch Update July 2009 for Oracle BEA Releases

    Hi All,
    Researching in metalink about CPU's for WLS 9.1 I found Oracle Support Note #835668.1. Table 9 of this document
    lists minimum product requirements for WebLogic server.
    According to this table WLS 9.1 should have a minimum version of 9.2MP3.
    I am confident that WLS 9.1 and WLS 9.2 are completely different WLS versions and there is no upgrade path from WLS 9.1 to WLS 9.2.
    Is this table misprinted or is it required to replace all WLS 9.1 installations with WLS 9.2 installations?
    What is this table trying to indicate?
    Please assist.
    It would be very helpful.
    Thanks.

    Oracle Critical Patch Update fix a list of bugs , oracle will release CPU in every three months interval.
    you need to click the link which oracle has sent.
    then choose your database version===then select the patch number===then on metalink download the patch
    with patch there is read me file which tell you how to apply the patch on the database.
    Thanks
    Regards,
    Taj

  • Problem installing Oracle Linux Release 5 Update 2 from Oracle e-Delivery

    Hello
    I have been trying to install Oracle Linux Release 5 Update 2 from Oracle e-Delivery so that I can install Oracle 11g express edition beta.
    Here are the steps that I took and the problem that I am having:
    1. I downloaded the file, unzipped the file twice, which gave me 3,042 files and 13 folders with the total size = 3.07 GB.
    2. I put in the DVD and restarted my PC hoping that my PC will boot from the DVD, but instead Window started.
    I reported this issue to tech support from e-Delivery, but they referred me to contact you. Please assist.
    Julia

    3,042 files and 13 folders with the total size = 3.07 GBWhich download .zip did you choose from edelivery? Under linux-x64 I peeked "Oracle Linux Release 5 Update 2 for x86_64 (64 Bit) - DVD" file V15099-01.zip downloaded, it has just the one .iso file. You'll need to burn that to DVD, but with burn s/w that handles ISO files.
    Also keep in mind you'll need 64 bit hardware (amd/intel 64? itanium? those are different), the only *nix platform I've got handy to try it out is -x86 :(                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Oracle 10g Release 2 Spatial

    Hi,
    I couldn't move these questions from another post, so I deleted them and put them here:
    Re: Migrating SDO_GEOMETRY to 10g TOPOLOGY
    Posted By: [email protected] on Dec 3, 2004 11:08:52 AM
    Hi, is there somewhere a roadmap (with dates) or/and a list of new spatial features in future releases of the oracle database
    Rolf
    Re: Migrating SDO_GEOMETRY to 10g TOPOLOGY
    Posted By: ronan.crowley on Jan 20, 2005 8:40:07 AM
    I agree, a roadmap with attached release dates and
    feature listings would be an excellent resource.
    Ronan

    Oracle isn't allowed to provide futures information in advance of product announcements, except under non-disclosure agreements.
    Oracle 10g Release 2 has been announced, so here is some high-level information about Spatial Features included in it:
    EPSG Coordinate System Support
    New parameters to sdo_filter, sdo_relate, and sdo_within_distance to only return data above or below a certain size with respect to the screen size(to prevent a large amount of data from rendering on a single pixel on the display, for instance)
    New indexing parameter to define how Spatial/Locator internally batches index updates at commit time to allow faster index processing during inserts, updates, and deletes.
    New utility function to automatically try to fix invalid geometries
    First shipping release of the spatial routing engine
    In GeoRaster:
    Compression (JPEG and DEFLATE)
    Cross-schema usage
    Requirements for raster data table uniqueness, and procedures to help maintain uniqueness
    Enhancements to GeoRaster Viewer
    In Topology:
    Add geometry interfaces for points, lines, and polygons
    Create feature interface (first full release)
    Load topo map procedure
    remove obsolete nodes
    Find the features this feature is created from in a hierarchy
    Can build feature layers in a hiercharchy either from previous layer or from primitives
    Simplified export/import
    Network Data Model
    Bidirected links
    cost columns based on function (dynamic costing)
    Also, numerous bug fixes across the board, and some other minor changes/additions

  • Hanging with Oracle 10g release 2 on Windows XP !!!

    Hi,
    I am trying to Install Oracle 10g release 2(10.2.0.1.0) on Windows XP Professional(SP2).
    Existing environment:
    1. Java(SDK & Runtime Environment) 6 update 1.
    2. Configured Eclipse.
    The installed procedure:
    1. Downloaded "10201_database_win32.zip" from Oracle website.
    2. Unzip it and run setup.exe
    3. It gives an error like below :
    "javaw.exe - Entry Point Not Found"
    "The procedure entry point longjmp could not be located in the dynnamik link library orauts.dll."
    Installation completed(forcefully) without the below.
    1. Oracle Net Configuration Assistant (Failed)
    2. Oracle Database Configuration Assistant (Failed).
    and in services: "No Oracle process exist".
    I tried the below:
    A. Change the environment variables (remove ORACLE_HOME/ORACLE_SID etc)
    B. 2 to 5 times un-install oracle(including registry, directory etc) and install.
    C. Uninstall Java SDK & Runtime Env. Then install Oracle.
    D. Installing Personal edition, Enterprise edition etc etc.
    E. Checked the orauts.dll in 3 places(i. BIN ii. out/bin iii. oui/lib/win32
    F. Copied the orauts.dll to system32 directory.
    What ever I do the above appers all the time and installation is incomplete.
    Due to this problem I couldn't move further, please do help me in solving this.
    Thanks a lot in advance.

    Hey Guys,
    I am Srinivas Here who had been trying to install Oracle Database 10G on Windows X86 on Windows XP Professional.
    If you have Win-XP Professional as your Operating System. Do not download the oracle Database using windows - XP Professional because XP will block certain installation files while downloading. In your machine install Windows 2000 or any other Windows version as a dual boot. First the download Database Zip files using your other version of Windows Operating system and then when you Unzip the files it will create a folder called Database and all the files will be present in it.If you want to store the same to cd for having to install the 10G Rel 2 database through CD then copy the contents of the unzipped database folder and store only the contents of the database folder and write them to CD's. Please see to it that while writing on cd's do not copy the folder itself .
    After this, restart the system and get into windows XP Professional (Your XP Professional should be with Service Pack 2 in order to install 10G Database on windows XP - The Basic requirements for Oracle Database 10G on Windows X86).
    I request you to check the software and hardware requirements from oracle Documents before you install the Oracle Database 10G on Windows x86 as well as Oracle Database 10G on Linux X86 or any other operating systems.
    Finally, After you run the Oracle Universal installer in the last you will get messages for all products installed Success and finally it will ask the password for DBA and open the password management and give the password and reenter password and on the left you will have to unlock the items you would like to use.
    In the last it will give you various URL links for Isqlplus, DBA, Enterprise Manager and a log report stored into oracle directory stored in your C:\Program files\Oracle folders. The correct link will be given at the end and you will have to watch the installation carefully.You can find DBCA and other options working. Try login in to Oracle through Command prompt, Sqlplus prompt availabe in Start ->Programs->Orahome10G->application Development-sqlplus as well as login through isqlplus link- Before this you should login at the command prompt as SYSDBA. YOU CAN SEE THAT YOUR DATABASE IS NOW WORKING IN WINDOWS XP PROFESSIONAL.
    THANKS IN ADVANCE TO ALL FORUM MEMBERS WHO GAVE ME IDEA AND SUPPORT
    REGARDS,
    SRINIVAS

  • How to dynamically update columns in a where clause to a SQL query in OSB?

    Hi Gurus,
    I have a requirement where in we need to dynamically update a where clause to a SQL query in OSB(11.1.1.6.0).
    For example:
    If the JCA sql string is "select * from emp where emp_id = 100 and emp_status ='Permanent'" now i want to change this where clause and the new query has to be like "select * from emp where emp_name like 'S%' and emp_dept like 'IT' ". basically we need to change the where clause dynamically.
    We can also use "fn-bea:execute-sql()" in a xquery but I don't want to use this function as creates a new connection.
    I have done some home work and found out --> as per the DOC "http://docs.oracle.com/cd/E23943_01/dev.1111/e15866/jca.htm#OSBDV943" section: "25.5.2 JCA Transport Configuration for Proxy and Business Services", when a business service is created by using JCA, we can see Interaction Spec Properties under JCA Transport Tab. This will have a property "SqlString' and we can over ride it. But I am unable to figure out how to over ride the value. I have tried by using Transport Headers activity but no luck. Please guide me how to achieve this?
    Thanks in advance
    Surya

    I solved my problem.
    In my header renderer, I simply added a line to set the text to the object value "label.setText( (String) value );" (where label is an instance of a JLabel.
    Thank you to who took some time to think about it.
    Marc

  • Dynamic UPDATE statement with parameters for column names.

    Hello,
    On this* website I read "The SQL string can contain placeholders for bind arguments, but bind values cannot be used to pass in the names of schema objects (table or column names). You may pass in numeric, date, and string expressions, but not a BOOLEAN or NULL literal value"
    On the other hand, in this Re: execute immediate with dynamic column name update and many other
    posts people use EXECUTE IMMEDIATE to create a dynamic UPDATE statement.
    dynSQL:='UPDATE CO_STAT2 CO SET CO.'||P_ENT_B_G_NAME||' = '||P_ENT_E_G_WE||'
    WHERE ST IN
    (SELECT ST FROM STG_CO_STAT2_TEST CO WHERE
    '||P_ST||' = CO.ST AND
    CO.'||P_ENT_E_G_NAME||' > '||P_ENT_E_G_WE||' AND
    CO.'||P_ENT_B_G_NAME||' < '||P_ENT_E_G_WE||');';
    EXECUTE IMMEDIATE dynSQL ;
    Since this statement is part of a Stored Procedure, I wont see the exact error but just get a ORA-06512.
    The compiling works fine and I use Oracle 11g.
    http://psoug.org/definition/EXECUTE_IMMEDIATE.htm

    OK I extracted from all of your posts so far that I have to use "bind-variables with :"
    From all the other tuorials and forums posts, I assume using the pipe is correct so I added those as well into the script:
    set serveroutput on format wraped;
    DECLARE
    dynSQL VARCHAR2(5000);
    P_ENT_E_G_NAME VARCHAR2 (100) :='test1'; P_ENT_E_G_WE VARCHAR2 (100) :='01.02.2012'; P_ENT_B_G_NAME VARCHAR2 (100) :='01.01.2012';
    P_ST                VARCHAR2 (100) :='32132';
    BEGIN
    dynSQL:= 'UPDATE CO_STAT2 CO SET CO.'||:P_ENT_B_G_NAME||' = '||:P_ENT_E_G_WE||'
                  WHERE ST IN (SELECT ST FROM STG_CO_STAT2_TEST CO WHERE
                  '||:P_ST||'                           = CO.ST                  AND
                  CO.'||:P_ENT_E_G_NAME||'     > '||:P_ENT_E_G_WE||' AND
                  CO.'||:P_ENT_B_G_NAME||'    
    < '||:P_ENT_E_G_WE||')';
    --this is somehow missing after the last < '||:P_ENT_E_G_WE||')';
    dbms_output.enable;
    dbms_output.put(dynSQL);
    --EXECUTE IMMEDIATE dynSQL;    
    END;Problem:I think I figured it out, the dates that I parse into the query need additional '

  • CMP 2 non mandatory timestamp field in Oracle 9 release 2

    Dears,
    My machine holds the following:
    Win XP pro SP 1
    Oracle 9i release 2 DB
    Jbuilder X enterprise Edition with SUN ONE App Server plugin
    SUN ONE Application server platform edition update 2
    They are all in the same machine (so there is no problem as issue 4707531 of using different Oracle drivers)
    I connect using OCI not thin.
    I got the following problem when trying to test my Session EJB that calls CMP.
    SEVERE ( 4716): EJB5071: Some remote or transactional roll back exception occurredcom.sun.jdo.api.persistence.support.JDODataStoreException: Got a JDBC SQLException.
    Please read the remaining error stack for more information.
    NestedException: java.sql.SQLException: Invalid column typeBy tracing the problem I noticed that my code works fine if I set a timestamp field in this table, this timestamp is not mandatory.
    Is it a bug in SUN ONE with Oracle 9i, or anyone have a solution?

    Hi Ash,
    Could you please verify that your .dbschmea file and table creation scripts are in sync. The easiest way to achieve this is to recapture the .dbschema file, repackage and redeploy.
    Thanks,
    Mitesh

  • Dynamic Update in real time with slider control

    We have requirements to display complex data in a graphical format. So far this has gone well by leveraging ADF and DVT components (dvt:Map, dvt:gauge, dvt:bargraph, af:tables, af:inputNumberSlider, etc.); however, we recently have been asked to add real-time animation of these controls over time. In brief, the user requires the ability to control the on-screen visualization of data by sliding the control on an af:inputNumberSlider (or equivalent) that represents a multi-month time scale. While sliding this control, the user expects to see the data visualization controls dynamically update in real time, keeping up with the rate at which the user moves the slider control. Think of this like a flip book animation where the slider controls the page the user is looking at and they can flip through the pages forwards or backwards at any desired speed. The time slider increments are one hour.
    Our current application architecture:
    Oracle ADF Fusion Web Application (v 11.1.1.5)
    EJB 3.0
    Eclipselink
    Oracle 11g
    Any kind of help is highly appreciated.
    Thanks,
    Mehabub

    Hi,
    the af:inputNumberSlider does not provide this functionality. Your alternative is a custom component (or any component that raises a client JS event) and call an af:serverListener in a custom event to send the notification to the server.
    Frank

  • Need to have more info about the latest patch on Oracle 10g Release 2

    Please this is the follwing answer that was given to explain the purpose of patching the latest release of Oracle 10g release 2.
    We are applying the patch to the 32bit environment to resolve memory errors.
    This patch should be applied to the 64bit environments too as to maintain consistency in our database versions
    Personaly I don't believe the response is accurate to patch the database.
    Does someone can tell me where to find more information about the latest path of Oracle 10g release 2?
    Thanks a lot

    You can find more information about a patchset by going over the readme document associated with the patch. As such, it is not exactly clear what kind of information you are looking for.
    Login into Metalink=>Patches&Updates=>Simple Search=>
    Product or Family=> RDBMS
    Select your OS
    if will your a link to the readme file...
    Hope this helps
    Thanks
    Chandra

  • 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

  • Oracle Designer6i Release 4 and Oracle9i Unable to add user to Repository

    Dear all,
    I am currently using Oracle9i with Oracle Designer6i Release 4. Before I am able to use both Release 4 and Release 2 with Oracle9i. However, this time when I install it after a cleanup in my server. I have received the following error message when allowing a user to use repository using RAU:
    Message
    RME-00020: Internal API error - ORA-00600: internal error code, arguments: [25012], [2147483647], [0], [], [], [], [], []
    RME-00011: Operation 'close' on ACTIVITY has failed
    RME-00222: Failed to dispatch operation to Repository
    RME-00224: Failed to close activity
    Please help. Thank you.
    Philip

    Hi
    I had exactly the same error and managed to get rid of it by deinstalling and reinstalling the client and the server with the patch (2083057) from metalink (I had previously used this patch for upgrade). There was no problem with user creation.
    However, I get the same error when I try to do anything with the repository, such as, create an object. So, this is really of no help. Sorry.
    Have you managed to get the installation going????
    Is there anyone who has Designer 6i functioning (even partially) with Oracle 9i on a windows platform, or for that matter any platform??
    Anita Srivastava

  • Can we use Dynamic SQL in Oracle Reports ?

    Hi ,
    Can we use Dynamic SQL in Oracle Reports ?
    If yes please give some examples .
    Thanx
    srini

    I believe the built-in package SRW.Do_Sql is what you are looking for
    Example from the document:
    /* Suppose you want to create a "table of contents" by getting the
    ** first character of a columns value, and page number on which its
    ** field fires to print. Assume that you want to put the "table of
    contents"
    ** into a table named SHIP. You could write the following construct:
    DECLARE
    PAGE_NO NUMBER;
    PAGE_FOR INDEX NUMBER;
    SORT_CHAR CHAR(1);
    CMD_LINE CHAR(200);
    BEGIN
    SORT_CHAR := :SORT_NAME ;
    IF :CALLED = Y THEN
         SRW.GET_PAGE_NUM(PAGE_FOR_INDEX);
         SRW.USER_EXIT(RWECOP PAGE_FOR_INDEX
         P_START_PAGENO);
         SRW.MESSAGE(2,TO_CHAR(:P_START_PAGENO));
    END IF;
    SRW.GET_PAGE_NUM(PAGE_NO);
    CMD_LINE := INSERT INTO SHIP VALUES
                          (||SORT_CHAR||,||TO_CHAR(PAGE_NO)||);
    SRW.MESSAGE(2,CMD_LINE);
    SRW.DO_SQL(CMD_LINE);
    COMMIT;
    EXCEPTION
      WHEN DUP_VAL_ON_INDEX THEN
            NULL;
      WHEN SRW.DO_SQL_FAILURE THEN
            SRW.MESSAGE(1,FAILED TO INSERT ROW INTO SHIP TABLE);
      WHEN OTHERS THEN
           COMMIT;
    END;

  • Information in the case folder is not getting updated in Oracle Credit Mgt

    Hi,
    I have created an SO and an Invoice for this SO for a particular customer. Now, when I create a credit application and a case folder in OCM for this customer, Fields like Receivables Balance, Credit Exposure, Days Sales Outstanding etc. in the case folder are not getting updated. These fields are not getting updated even after refreshing the case folder. It means that the information from the 'Receivables Responsibility is not getting updated in the case folder.
    I have already run the 'Initialize credit Summaries' concurrent program after creating the Sales Order and Invoice.
    PS: The case folder gets updated only when I set the Profile Option: "AR: Allow summary table refresh" to Yes and then running the "Refresh AR Transactions Summary Tables" concurrent program. But once this program runs the Profile Option again becomes 'No' (Which is a Standard functionality).
    So this is a manual way to update the case folder. My requirement is that the case folder should get updated automatically and no manual intervention should be required.

    Sumit Malik wrote:
    Hi,
    I have created an SO and an Invoice for this SO for a particular customer. Now, when I create a credit application and a case folder in OCM for this customer, Fields like Receivables Balance, Credit Exposure, Days Sales Outstanding etc. in the case folder are not getting updated. These fields are not getting updated even after refreshing the case folder. It means that the information from the 'Receivables Responsibility is not getting updated in the case folder.
    I have already run the 'Initialize credit Summaries' concurrent program after creating the Sales Order and Invoice.
    PS: The case folder gets updated only when I set the Profile Option: "AR: Allow summary table refresh" to Yes and then running the "Refresh AR Transactions Summary Tables" concurrent program. But once this program runs the Profile Option again becomes 'No' (Which is a Standard functionality).
    So this is a manual way to update the case folder. My requirement is that the case folder should get updated automatically and no manual intervention should be required.Duplicate post -- Information in the case folder is not getting updated in Oracle Credit Mgt

Maybe you are looking for

  • Javaserver Faces using JDeveloper (10.1.3) tutorial problem

    Trying to complete the above tutorial but in the "Creating a conditional navigation" when I try to run I get an error on Login.java Error(81,7): identifier FacesContext not found Error(81,62): FacesMessage not found in class view.backing.Login The co

  • FDMEE 11.1.2.4 compatibility with Shared Services 11.1.2.3.500

    Hi, I am wondering if FDMEE 11.1.2.4 can co-exist in an 11.2.3.500 environment. I already read the oracle certification matrix, but I'm not sure if I'm getting it right. Best regards,

  • Dashed line in muse?

    When will I be able to create a dashed line in muse?

  • Oracle 11GR2 on windows 2008 Geo-Dispersed cluster

    Hi all, anyone can guide me about the installing oracle 11GR2 on windows 2008 Geo-dispersed cluster environment? Please guide and provide documentation if possible, thanks

  • Im sick to death of this error 3194

    I've tried everything possible, look at a million youtube vids, ALOT of guides to fix this but NOTHING works.. i ALWAYS get the same error(3914) when trying to update/restore my iphone. its really frustating me now. (trying to update my ipod from 4.3