Need to simulate identity behaviour in Oracle

I have 2 tables,Table A and Table B.
I insert tuples into Table A which has its primary column as identity.
I have used SEQUENCE in Oracle to simulate behaviour of identity in MS-SQL Server.
Once I have inserted in table A,I need to access the identity value inserted in
Table A and put it in table B.In short I need something that simulates scope_identity() function in SQL Server....
Could any body suggest something..
Thanks for the help

Something like that works too.
SQL> create table t_a (id number);
Table created.
SQL> create table t_b (id number);
Table created.
SQL> create sequence seq_1;
Sequence created.
SQL> create or replace package pkg_scope
  2  is
  3   type id_scope_tab is table of t_a.id%type index by binary_integer;
  4   function scope_identity(clear boolean) return id_scope_tab;
  5   procedure add_element(id t_a.id%type);
  6  end;
  7  /
Package created.
SQL> create or replace package body pkg_scope
  2  is
  3   id_scope id_scope_tab;
  4   function scope_identity(clear boolean) return id_scope_tab
  5   is
  6    scope id_scope_tab := id_scope;
  7   begin
  8    if clear then
  9     id_scope.delete;
10    end if;
11    return scope;
12   end;
13   procedure add_element(id t_a.id%type)
14   is
15   begin
16    id_scope(id_scope.count+1) := id;
17   end;
18  end;
19  /
Package body created.
SQL> create or replace trigger tr_aifer_t_a
  2  after insert on t_a
  3  for each row
  4  begin
  5   pkg_scope.add_element(:new.id);
  6  end;
  7  /
Trigger created.
SQL> create or replace trigger tr_bifer_t_a
  2  before insert on t_a
  3  for each row
  4  begin
  5   select seq_1.nextval into :new.id from dual;
  6  end;
  7  /
Trigger created.
SQL> insert into t_a values(null);
1 row created.
SQL> /
1 row created.
SQL> /
1 row created.
SQL> select * from t_a;
        ID
         1
         2
         3
SQL> select * from t_b;
no rows selected
SQL> declare
  2   ids pkg_scope.id_scope_tab := pkg_scope.scope_identity(true);
  3  begin
  4   forall i in ids.first..ids.last
  5    insert into t_b values(ids(i));
  6  end;
  7  /
PL/SQL procedure successfully completed.
SQL> select * from t_b;
        ID
         1
         2
         3
SQL> insert into t_a values(null);
1 row created.
SQL> /
1 row created.
SQL> select * from t_a;
        ID
         1
         2
         3
         4
         5
SQL> declare
  2   ids pkg_scope.id_scope_tab := pkg_scope.scope_identity(true);
  3  begin
  4   forall i in ids.first..ids.last
  5    insert into t_b values(ids(i));
  6  end;
  7  /
PL/SQL procedure successfully completed.
SQL> select * from t_b;
        ID
         1
         2
         3
         4
         5Also you can use BULK COLLECT INTO tougether with Kamal's example to
keep a range of values:
SQL> declare
  2   ids pkg_scope.id_scope_tab;
  3   ids_out pkg_scope.id_scope_tab;
  4  begin
  5   for i in 1..3 loop
  6    ids(i) := 0;
  7   end loop;
  8   forall i in 1..3
  9    insert into t_a values(ids(i)) returning id bulk collect into ids_out;
10   forall i in ids_out.first..ids_out.last
11    insert into t_b values(ids_out(i));
12  end;
13  /
PL/SQL procedure successfully completed.
SQL> select * from t_a;
        ID
         1
         2
         3
         4
         5
         6
         7
         8
8 rows selected.
SQL> select * from t_b;
        ID
         1
         2
         3
         4
         5
         6
         7
         8
8 rows selected.Rgds.

Similar Messages

  • Need to understand jobs' behaviour in Oracle8i

    I have looked over Oracle8i documentation, including Oracle Concepts, but I can't understand behaviour of Oracle jobs well enough.
    Q1. Can two or more jobs be run at the same time? E.g. I have two jobs -- the first have to start at 3:00 and to do something in the database for 30 minutes; the second have to start at 3:01.
    Will the second job start at 03:01 or at 03:30, when the second one will have finished?
    Does the JOB_QUEUE_PROCESSES regulate the maximum amount of jobs running at the same time?
    Q2. Is it possible to create a new job from another job? E.g., a job starts PL/SQL procedure which creates a new job using DBMS_JOB package?

    Justin and Andrew!
    I am realy doing something like a workflow processor. Unfortunately, using Oracle workflow is out of discussion -- I can use only Oracle RDBMS. It's our customer's decision. Nevertheless, we don't need almost all features of Oracle Workflow. At least, at the present stage of development. It seems too complicated for this project and not reasonable.
    This sounds like you are trying to simulate a
    workflow processor. You have a number of tasks with
    varying degrees of dependence between them: task a, b
    and c can be run in order order but task d can only
    run after task a, b and c have run successfully.
    I'm not sure that DBMS_JOB is the option I would have
    chosen. True it allows you to run a, b and c in
    parallel, but task d must either run as a daemon or
    must be scheduled after a long gap. True it could be
    launched from task c but what if task a has completed
    yet?
    Under the circumstances, I would have plumped for a
    single, permanently running procedure with a process
    map constructed out of IF statements, procedures that
    return a STATUS variable and a table for scheduling
    tasks. If I got completely carried away I might
    refactor all that into a set of tables containing the
    process map and a single pocedure that used EXECUTE
    IMMEDIATE - if the process map was likely to be
    fairly fluid.I am on the same way. I will have one job being launched very often and running a procedure which checkes the schedule (or process map) and creates new jobs for tasks must be run if all conditions needed for running each task are OK.
    I am going to use jobs to run my tasks in parallel and at the defined time. And I can't understand, Andrew, how I can use EXECUTE IMMEDIATE for this purpose?

  • Transactional Behaviour of Oracle B2B 11g

    Hi Gurus/Anuj,
    Can you please explain Transactional Behaviour in Oracle B2B 11g?
    For a Inbound Interface I have three Mediators(Mediator M1,M2 and M3)
    Partner push a file at file location --> B2B Interface used in M1 ,through B2B Binding,picks the FIle and brings to SOA and--> Give it to M2 and M3.
    I need to perform Error Handling in this case..
    M1 M2 and M3 are Asynchronous,Synch and Synch in nature and I guess M1 will propogate it's transaction to M2 and M2 will propogate it's transaction to M3.
    Routing rules are Sequential..
    Note : Fault policies are applicable to parallel routing rules only. For sequential routing rules, the fault goes back to the caller and it is the responsibility of the caller to handle the fault.
    Am I correct in understanding that :
    B2B Adapter in M1 is the caller and M2 and M3 ,as being Synchronous,will follow M1'a transaction.
    And if a Fault goes into M2 and M3,it will go back to the caller,means M1.
    And in M1 we can have Fault-Handling.
    Also please explain Transactional Behaviour in Oracle B2B 11g?
    Is B2B is Asynchronous in nature?
    Is B2B Adapter a Transactional Adapter?
    What category of JCA adapter is Oracle B2B adapter?
    Thanks
    Vivek
    Edited by: Vivek on May 19, 2011 11:41 PM
    Edited by: Vivek on May 19, 2011 11:54 PM

    Hi Vivek,
    Also please explain Transactional Behaviour in Oracle B2B 11g?Oracle B2B depends upon the underlying transport being used for transactional behavior. As far as transaction propagation is concerned, we never had any such need in B2B communication.
    Am I correct in understanding that :
    B2B Adapter in M1 is the caller and M2 and M3 ,as being Synchronous,will follow M1'a transaction.
    And if a Fault goes into M2 and M3,it will go back to the caller,means M1.
    And in M1 we can have Fault-Handling.If you are using AQ interface of B2B adapter with XA Data Source then that adapter can participate in an XA global transaction that can span multiple resources. In this transaction, the application server acts as the coordinating transaction manager with multiple databases (or other resources such as JMS), each of which is involved in a single transaction.
    If you are using JMS interface of B2B adapter with XA Connection factor then that adapter can also participate in an XA global transaction that can span multiple resources.
    If you are using Default (Fabric) interface of B2B adapter then it does not participate in global transaction, rather it starts it's own local transaction and executes in that. So it will totally depend upon the interface you are using with B2B adapter that it will start and propagate a global transaction or will not participate in a global transaction. Moreover, if B2B adapter is starting a transaction and propagating it to a async service then that sync service will start a new local transaction and further sync services may execute in that transaction. As soon as the control comes back to B2B adapter, it will commit the transaction.
    Is B2B is Asynchronous in nature?B2B can be used for both sync and async calls (between partners). B2B is async when communicating with middleware.
    Is B2B Adapter a Transactional Adapter?Explained above
    What category of JCA adapter is Oracle B2B adapter?No special category. It is a specific adapter for Oracle SOA SCA composites to facilitate them in communication with Oracle B2B. You may or may not use this adapter in SOA SCA composites.
    Regards,
    Anuj

  • Equivalent to SQL Server IDENTITY columns in Oracle 8i?

    Under SQL Server, my app frequently keys tables using IDENTITY columns which are also used as the only column in the tables primary key. After an INSERT, I typically retrieve the value assigned to the IDENTITY column using:
    SELECT @@IDENTITY
    I need to port my app to Oracle 8i and wonder if there is a similar concept available. I checked out ROWID and UROWID but they don't sound quite right.
    Any idea?

    You can use the sequence directly in your insert
    without use a trigger
    For example:
    SQL> Create table nn ( c1 number, c2 varchar2(34));
    Table created.
    SQL>
    SQL> CREATE SEQUENCE customers_seq
    2 START WITH 5
    3 INCREMENT BY 1
    4 NOCACHE
    5 NOCYCLE;
    Sequence created.
    SQL>
    SQL> insert into nn values (customers_seq.nextval, 'jjj');
    1 row created.
    SQL> insert into nn values (customers_seq.nextval, 'mmm');
    1 row created.
    SQL> select * from nn;
    C1 C2
    5 jjj
    6 mmm
    SQL>
    [email protected]
    Joel P�rez

  • Identity field in Oracle 11.2 with EF6

    Hi,
    I am in model first and I need to use Identity field to generate PK
    This is my code
    using (var ctx = new Model14Container())
    var newElem = ctx.Entity12.Add(new Entity12());
    ctx.SaveChanges();
    var elem = ctx.Entity12.FirstOrDefault();
    The Id is always 0. And I have a PK error the second time
    I use Generate Oracle Via T4 (TPT).xaml (VS) and SSDLToOracle.tt (VS) in VS2013 with ODP 12c release3
    The SQL code is generated without sequence
    I tried with Devart and I had no problem
    Thanks
    Romain

    I try the trial version of DevArt and this is the result
    -- This is auto-generated SQL script.
    -- This DDL was generated by 'Devart SSDLToOracle.tt' template.
    -- SQL is generated on: 01/23/2015 16:17:07
    -- Generated from EDMX file: c:\Model1.edmx
    -- Dropping existing foreign keys
    -- Dropping existing tables
    DROP TABLE "Entity1"
    DROP SEQUENCE "Entity1_SEQ"
    -- Creating all tables
    -- Table "Entity1"
    CREATE TABLE "Entity1"  (
        "Id" NUMBER(10) NOT NULL,
        PRIMARY KEY ("Id")
    CREATE SEQUENCE "Entity1_SEQ"
    CREATE OR REPLACE TRIGGER "Entity1_INS_TRG"
        BEFORE INSERT ON "Entity1" FOR EACH ROW
    BEGIN
        SELECT "Entity1_SEQ".NEXTVAL INTO :NEW."Id" FROM DUAL;
    END;
    And this is the SQL script generated by Oracle
    -- Entity Designer DDL Script for Oracle database
    -- Date Created: 1/23/2015 4:28:48 PM
    -- Generated from EDMX file: C:\Model1.edmx
    -- Dropping existing FOREIGN KEY constraints
    -- Dropping existing tables
    -- Creating all tables
    -- Creating table 'Entity1'
    CREATE TABLE "dbo"."Entity1" (
       "Id" NUMBER(10) NOT NULL
    -- Creating all PRIMARY KEY constraints
    -- Creating primary key on "Id"in table 'Entity1'
    ALTER TABLE "dbo"."Entity1"
    ADD CONSTRAINT "PK_Entity1"
       PRIMARY KEY ("Id" )
       ENABLE
       VALIDATE;
    -- Creating all FOREIGN KEY constraints
    -- Script has ended
    For both tests, I use the standard EMDX Designer
    You can see the diffrence: no "dbo", "/" instead of ";", SEQ created
    With DevArt, we have a real working Oracle SQL script
    All the code is in the .tt file
    Can you have the same result ?
    I am ready to test your fix
    Regards
    Romain

  • Need Assistance for VBA function in oracle how to implement

    My very respected and Senior, regards,
    Sir, hope you will in best of health and wealth by the grace of God,
    Sir, i have a request problem as i m very junior against you and you have passed this time before many years ago as i m standing where. Sir i m a very junior developer of oracle and have a problem putting on your desk with the hope that you can help my as a boss.
    Sir me have to calculate yield of Bond using oracle form
    i have tried my best and tired
    there is a formulae in excel which give the Yield() when we provide the parameters
    and i need the excel formulae or the oracle calculation code of PLSQL for this.
    How can i get yield when i have price, coupon rate, frequency, issue and maturity of the coupon , coupon period , next coming coupon , and others detail.
    or tell me how to use EXCEL VBA for this problem ,
    thnx n regards,
    yours student, junior developer youngest brother
    Faraz
    How can I get the solution using Excel VBA function with oracle
    so that move values to excel calculate them and copy the result from excel to oracle forms

    Hi,
    for the Hex-Number-conversion see:
    [url http://psoug.org/snippet/Convert-Hex-to-Decimal-Decimal-to-Hex_78.htm] self-defined Conversion-Functions
    What number format do you have? YYYMMDD
    Or is there a Date corresponding to 1 and a number n represent the date n-1 days after day 1?
    Please describe further.
    Bye
    stratmo

  • Need information regarding setAutoCommit(false) in oracle otd

    Hi All,
    I need to insert data to two oracle tables. If data insertion to both tables are success then connection should commit else it should not commit.
    Hence for this i set
    1) oracleOtd.setAutoCommit(false);
    The i inserted value to first table. During insertion to second table it
    gave exception for me.
    But when i checked database the data has been inserted to database
    even though there is an exception.
    I believe this oracleOtd.setAutoCommit(false) doesn't have any effect.
    Please leet me know if i need to do some additional settings.
    Regards
    Venkatesh.S

    I use this same function (using JavaCAPS 5.1.1) and, admittedly, the opportunity to "test" this hasn't come up.
    However, consider putting a rollback call in your catch-block.
    oracleOtd.rollback();Dave

  • I need to download a copy of Oracle for W98

    I need to download a copy of Oracle for W98, but I can't seem to find it anywhere...
    I believe the personal edition is free , but the only one I can find on this site is 9i which is for NT/2000 or XP pro
    can you please direct me towards another site or a place on this site where I can download a stand-alone version (any version) of Oracle that will work with W98 ?
    thank you !

    Here is the site:
    http://otn.oracle.com/software/htdocs/devlic.html?/software/products/8i_personal/htdocs/winsoft.html

  • SP2-0750: You may need to set ORACLE_HOME to your Oracle software directory

    Hi all,
    In windiws 2008 server i have installed 11g wtih 11g Client for Pro*c . so there is two Oracle_Home resides. In the same machine i have installed 11g Forms and reports with weblogic server.
    Now i am not able to connect with the Database in SQL Prompt.more over if i issue SQLPLUS i am getting this below error
    "+Error 6 initializing SQL*Plus+"
    "*Message file sp1<lang>.msb not found*"
    "*SP2-0750: You may need to set ORACLE_HOME to your Oracle software directory*"
    Here my Question and doubt is how i have to solve this issue.i want to use this 11g Database and 11g Forms and reports in single server. how to do this ?
    Kindly share your Advice.
    Regards
    Hamid

    Hameed wrote:
    "+Error 6 initializing SQL*Plus+"
    "*Message file sp1<lang>.msb not found*"
    "*SP2-0750: You may need to set ORACLE_HOME to your Oracle software directory*"
    Here my Question and doubt is how i have to solve this issueIt is clearly said - set ORACLE_HOME prior to runing sqlplus.

  • Need to simulate screen-shooting a window

    Hi there
    I need to simulate a screenshot of a window of Safari. Basically: CMD+SHIFT+4+SPACE+click.
    I have a script that works for a screenshot of the entire screen, but since my screen is only 1200x800 I need to take an SS of the window while it's resized and a part of it is not visible. If I do it manually it works like a charm, but I need a script because I need to do it a few hundred times.
    I've tried using cliclick but I ran into some trouble and I'm stuck. The site loads, the window gets selected, the screen goes gray in anticipation of a click, but no clicking happens. Anyway, here's my script, hope you can help me.
    p.s. I'm not sure if my CODE tags will wrap my code in code tags, I'm a bit daft today
    [CODE]
    set myURL to "X"
    repeat with myPage from 1 to 325
              tell application "Safari"
                             set the URL of the front document to (myURL & myPage)
           activate
                             do shell script "/Users/macjohn/Desktop/cliclick d:400,100"
              end tell
      delay 5
              set myPath to ((POSIX path of (path to desktop)) & "screenshots/" & myPage & ".jpg") as string
              do shell script "screencapture -W " & quoted form of myPath
    end repeat
    [/CODE]

    Hello
    Here's a simple command line utility written in C to caputure specified window's image and save it as png. I first tried to do this in rubycocoa for convenience but in vain because the used function CGWindowListCreateImageFromArray() always returns nil in rubycocoa for some reason. So here's C version.
    # Recipe.
    A) To compile and test the C programme.
    A1) Copy the code listed below as main.c into new document of text editor (e.g. TextEdit) and save it as plain text named "main.c" on desktop.
    A2) In Terminal.app, run the following commands (type each line followed by return):
    cd ~/Desktop
    gcc -framework ApplicationServices -o windowcapture main.c
    and it will create an executable file named "windowcapture" on desktop.
    A3) For brief test, first in Ssfari, have a window open and then in Terminal.app, type the following satements (each followed by return):
    wid=$(osascript -e 'tell application "Safari" to get id of window 1')
    ./windowcapture $wid out.png
    This will capture the front window of Safari and save it as out.png on desktop.
    B) To create an AppleScript wrapper to call this utility.
    B1) Create a new AppleScript script with the following contents and save it as a script bundle or an application bundle:
    tell application "Safari" to set wid to window 1's id
    set p to (path to resource "windowcapture")'s POSIX path
    do shell script "cmd=" & p's quoted form & "; wid=" & wid & "
    out=~/Desktop/$(date +'%F %H.%M.%S.png')
    \"$cmd\" \"$wid\" \"$out\""
    B2) Show package contents (via contextual menu) of the saved bundle and put the executable file "windowcapture" loose in its Contents/Resources directory. Now you can run the script bundle or the application bundle to capture the front window of Safari and save it as a time-stamped png file on desktop.
    # Notes.
    • You need to have Developer Tools (Xcode and its command line tools) installed to build the programme.
    • Tested under 10.6.8 but no warranties of any kind.
    • This is free software you may use and modify as you like.
    # File
    main.c
        file
            main.c
        function
            capture image from window specified by window id (CGWindowID) and save it as png file.
        compile
            gcc -framework ApplicationServices -o windowcapture main.c
        usage e.g.
            ./windowcapture 251 outfile.png
    #include <ApplicationServices/ApplicationServices.h>
    #include <libgen.h>    // basename
    int
    main (int argc, char * argv[])
        if ( argc != 3 )
            fprintf(stderr, "Usage: %s <window ID> <outfile>\n", basename(argv[0]));
            return 1;
        CGWindowID wid = (CGWindowID) atoi(argv[1]);
        CFStringRef outfile = CFStringCreateWithCString(kCFAllocatorDefault, argv[2], kCFStringEncodingUTF8);
        CFURLRef url = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, outfile, kCFURLPOSIXPathStyle, false);
        CFRelease(outfile);
        CGWindowID wids[] = { wid };
        CFArrayRef widarray = CFArrayCreate(kCFAllocatorDefault, (const void **)wids, 1, NULL);
        CGImageRef img = CGWindowListCreateImageFromArray(CGRectNull, widarray, kCGWindowImageDefault);
        CFRelease(widarray);
        if ( !img )
            fprintf(stderr, "Failed to create image from window id: %d\n", (int) wid);
            return 1;
        CGImageDestinationRef idst = CGImageDestinationCreateWithURL(url, CFSTR("public.png"), (size_t) 1, NULL);
        CFRelease(url);
        CGImageDestinationAddImage(idst, img, NULL);
        bool b = CGImageDestinationFinalize(idst);
        CFRelease(idst);
        return b ? 0 : 1;
    Hope this may help,
    H

  • Urgent Need for creating 100 tables in Oracle.

    Hello All,
    I need to create 100 tables in oracle using a loop.
    Please suggest . Advance thanks for your efforts.
    ANto

    I am getting the foll error at run time when executing the procedure ..
    ERROR at line 1:
    ORA-01031: insufficient privileges
    ORA-06512: at "ORAUSER.CREATE_100_TABLE", line 9
    ORA-06512: at line 1
    The script goes here ...
    create or replace procedure create_100_table
    is
    v_sql_string varchar2(200);
    begin
    for i in 1..100
    loop
    v_sql_string := 'create table ajames' || i || ' as select * from emp';
    execute immediate v_sql_string;
    end loop;
    end;
    ------------------------

  • Migration from SIM(Sun Identity Manager) to Oracle IDM

    hi
    Anyone having any knowledge on Migration from SIM(Sun Identity Manager) to Oracle IDM. Please share the knowledge/doc/links. Would helps me lot.
    Thanks
    .\idm

    Hi,
    Basic migration information can be found here. http://www.oracle.com/us/products/middleware/identity-management/upgrade/index.html
    I believe more detailed information will be available soon.

  • Dear frnz, i am doing my prjct in Lview. ie online PQ monitoring​. i need to simulate the system with disturbanc​es generated in Lview. so can any bdy plz tel me how to genrte PQ problems in labview. thanks in advance..

    dear frnz, i am doing my prjct in Lview. ie online PQ monitoring. i need to simulate the system with disturbances generated in Lview. so can any bdy plz tel me how to genrte PQ problems in labview. thanks in advance..

    I work in the power conversion industry and do these types of measurements all the time…
    Do you want to just measure power quality or create and measure power quality problems?
    What hardware are you using?
    Power quality analyzer?
    Programmable AC power source?
    Fast Transient Generator?
    Here is an example of what I do.
    To create PQ problems I use a California Instruments AC source set to nominal power for the unit under test. Using Labview I program several transients consisting of fixed and random duration dropouts and surges. I also use a Schaffer Fast Transient Burst Generator to apply high frequency noise bursts directly onto power lines.
    For measuring power quality I use a Voltech PM3000A power analyzer and Labview to measure everything from voltage, current, and frequency, to  harmonics and %THD
    Message Edited by RTSLVU on 07-23-2008 10:31 AM

  • Need help with Thin JDBC connecting Oracle to SQL server.

    I am fairly new to JAVA. We have ORACLE 8.1.7 running on Solaris 8. I have a need to
    periodically extract data from ORACLE DB and transfer it to SQL Server. I am limited to
    moving data from the ORACLE/UNIX environment to SQL Server side.
    From what I have read, Server-side Thin driver should work.
    1) Are there any issues in trying to achieve this with ORACLE running on the UNIX platform?
    2) Will the Server-side Thin driver talk to both the DBs ?
    3) Is it possible to provide some sample code ?
    Thanks in advance,
    Solomon

    Quattro,
    I had complete success in reading from Oracle and writing to SQL Server. First of all let me thank you for all your help. I do have one last request. Its more on optimization than any thing else.
    I was trying to optimize my code by grouping both the connections in one place and to keep my reads and inserts together so that I don't commit at the end of each insert etc. I don't seem to have the scope rules under control yet. Could you suggest how to improve this:
    import java.sql.*;
    public class Test_Combined2 {
    public static void main(String args[]) throws SQLException {
    // Load the Oracle JDBC driver
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    // Connect to the database
    // You must put a database name after the @ sign in the connection URL.
    // You can use either the fully specified SQL*net syntax or a short cut
    // syntax as <host>:<port>:<sid>. The example uses the short cut syntax.
    Connection con2 = DriverManager.getConnection ("jdbc:oracle:thin:@Test:1521:PSDEVElOP",
    "SOLOMON","SOL1");
    // Create a Statement
    Statement stmt2 = con2.createStatement ();
    String url = "jdbc:microsoft:sqlserver://INTRADEV:1433;DatabaseName=Measure";
    Connection con;
    String query = "select dataYear, dataMonth, yieldRate from tblYield " ;
    Statement stmt;
    try {
    Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
    } catch(java.lang.ClassNotFoundException e) {
    System.err.print("ClassNotFoundException: ");
    System.err.print(e.getMessage());
    // Select the ENAME column from the EMP table
    ResultSet rset = stmt2.executeQuery ("select year_start, monthofyear, percent_comp " +
    " from ps_usm_ytd_yield ");
    // Iterate through the result and print the employee names
    while (rset.next ()) {
    System.out.println (rset.getFloat (3));
    int ps_dataYear = rset.getInt(1);
    int ps_dataMonth = rset.getInt(2);
    float ps_yieldRate = rset.getFloat(3);
    try{
    con = DriverManager.getConnection (url, "tmpuser","tmppush");
    stmt = con.createStatement();
    PreparedStatement insertTblYield;
    String insertString = "insert into tblYield " +
    " values(?, ?, ?)";
    //con.setAutoCommit(false);
    insertTblYield = con.prepareStatement(insertString);
    insertTblYield.setInt(1, ps_dataYear);
    insertTblYield.setInt(2, ps_dataMonth);
    insertTblYield.setFloat(3, ps_yieldRate);
    insertTblYield.executeUpdate();
    con.commit();
    //con.setAutoCommit(false);
    /*ResultSet rs = stmt.executeQuery(query);
    System.out.println("dataYear, dataMonth, yieldRate");
    while (rs.next()) {
    int dataYear = rs.getInt(1);
    int dataMonth = rs.getInt(2);
    float yieldRate = rs.getFloat(3);
    System.out.println(" " + dataYear + ", " + dataMonth + ", " + yieldRate);
    stmt.close();
    con.close();
    } catch(SQLException ex) {
    System.err.print("SQLException: ");
    System.err.println(ex.getMessage());
    } //while
    stmt2.close();
    con2.close();

  • Primavera Expedition 8.5 standalone with Sybase database on windows 32 bits. We need to upgrade existing expedition to Oracle contract manager 13.1.

    Primavera Expedition 8.5 standalone with Sybase database on windows 32 bits. We need to upgrade existing expedition to Oracle contract manager 13.1.
         We are unable to upgrade Sybase database version from 8.5 to 10.0 before migration to oracle database. Please share the path and details of convert.exe we are unable to find in the oracle contract manager 13.1 binaries files.
    How To: Upgrade Expedition 8.5 Sybase databases to 10.x in preparation for upgrade to Contract Management 13 (Doc ID 914273.1)
    Regards,
    Amit

    The convert.exe to which the article refers is in the v13 setup files, and not in 13.1.

Maybe you are looking for

  • Filling out PDF forms & Saving with Preview

    I've been having some frustrations with PDFs & Preview. 1.) Recently I had to fill out the IRS W9 form.  With Preview I filled it out, added my signature and saved it.  Again when I sent it to someone else, they could only see my signature and not an

  • Text components

    Hello, I thought copy/paste functions (ctrl v, ctrl c) were automatically included in Swing Text components but when they are on a JApplet, they don't always work. The keyword is always which is weird because on some computers it works, but others it

  • Links embedded in OS X Mail will no longer open in Firefox 3.6.12.. open in all other browsers

    When a link in an email is clicked, application switches to Firefox 3.6.12, but will not open a new tab or go to the desired link. In 3.6.11 and previous versions, this was never a problem. If I switch my default browser to Safari, IE8 (in a virtual

  • Where is Net8

    All, I am planning to use Net8 as a connection manager for an mts database. It will be on a separate server. I want to see if it will lower cpu footprint on the database by reducing the no. of connections on the database and off loading the work to M

  • Shared objects & arabic/chinese

    I discovered a strange problem with shared objects. Whenever I change a slot with a slot name in arabic, chinese or english characters it works fine. so.setProperty(selectedLanguage, "xxxxxx"); But when I want to delete a slot like this: so.setProper