Entering data through prepared statement

Hello everyone,

I have a region, it contains some elements. These items are associated with their point of view the attributes of a basic VO EO

I have a button to validate the insert transaction

My requirement is:

At the same time of the insertion (at the click event):

  1. I need to insert the values of these attributes in table1,
  2. I need to use among these 2 elements to do a different insertion into another table.

For the first insertion, it works by combining these elements with attributes of an EO according to VO

For the second insertion, I can't associate these two points with an another VO. If I create a method that contains a statement prepared with a request for insertion?

This is the method that I created to be invoked to the click event: (he did not)

        OraclePreparedStatement oraclePreparedStatement = null;
        OracleResultSet oracleResultSet = null;
        StringBuffer stringBuffer = new StringBuffer();
        
        
        
        stringBuffer.append("insert into xx_onda_afaf_trace ");
        stringBuffer.append("(ID_ACTION,ID_FACTURE,DATE_RELLE,DATE_SYSTEME,LAST_UPDATE_DATE,LAST_UPDATED_BY,Creation_date,created_by) ");
        stringBuffer.append("VALUES (20,'1E',SYSDATE,SYSDATE,SYSDATE,0,SYSDATE,0)");
        OADBTransaction oadbTransaction = this.getOADBTransaction();
        try {
            oraclePreparedStatement = (OraclePreparedStatement)oadbTransaction.createPreparedStatement(stringBuffer.toString(),1);
            oracleResultSet = (OracleResultSet)oraclePreparedStatement.executeQuery();
            oadbTransaction.commit();
            
        }
        catch(Exception sqlException)
        {
            sqlException.printStackTrace();
        }

Is could someone please tell me what is the right thing to do in this case?

Thank you

Kind regards

Afaf

You can create of VO based on multiple EO also. Not sure if this is possible in your use case.

See you soon

AJ

Tags: Oracle Applications

Similar Questions

  • Table query result using prepared as a parameter in the prepared statement later

    Hi all

    Very new to PHP. A series of 3 prepared statements (see code below), I'm trying to sink.  This page is triggered from a link on a page that lists the individual and all candidates which works well.  Prepared statement 1 works and displays the data in the columns line wanted specific, bottom access so I would call it record and areas, but I think it is called line and columns here.  Prepared Statement 2 which hands on a table of cross references (we have a many-to-many relationship between candidates and positions, therefore for the table of cross references) works and I can say the $selected_positions charges table, because I can see position_id data in the < body > of the file using this:

    <? PHP

    foreach ($selected_positions as $item) {}

    echo $item. "< br / > ';

    }

    ? >

    Can't take this $selected_positions table and use it as parameter in the prepared statement 3, at least not how I try to do.  So obviously he manages not prepared statement 3 no way is a table that I called $the_positions which is supposed to contain the ID of the post, position of securities and to position the position_id numbers that are in the array $selected_positions.  I can say that 3 of prepared statement is a failure because there is no indication in this table that is in the < body > of the file:

    < table class = "stripes table" >

    < b >

    Identification of the Position < /th > < th >

    < /Th > < th > post number

    Title < th > < /th >

    < /tr >

    <? PHP while ($stmt-> fetch()) {? >}

    < b >

    < td > <? = $position_id;? > < table >

    < td > <? = $position_number;? > < table >

    < td > <? = $title;? > < table >

    < /tr >

    <? PHP}? >

    < /table >

    Here is the PHP script:

    <? PHP

    require_once '... /includes/session_timeout_db.php';

    ? >

    <? PHP

    require_once '... /includes/Connection.php';

    initialize the flag

    $OK = false;

    $conn = dbConnect ('read');

    initialize statement

    $stmt = $conn-> stmt_init();

    If (isset($_GET['candidate_id'])) {}

    $sql = ' SELECT candidate_id, last_name, first_name, society, mas_number, last_modified, notes

    CANDIDATES WHERE candidate_id =?'; }

    If ($stmt-> {prepared ($sql))}

    bind the query parameter

    $stmt-> bind_param ('i', $_GET ['candidate_id']);

    run the query and fetch the result

    $OK = $stmt-> execute();

    bind the results to variables

    $stmt-> bind_result ($candidate_id, $last_name, $first_name, $company, $mas_number, $last_modified, $notes);

    $stmt-> fetch();

    free resources for the second query database

    $stmt-> free_result();

    }

    get the associated positions candidate

    $sql = 'SELECT position_id FROM pos2cands WHERE candidate_id =?';

    If ($stmt-> {prepared ($sql))}

    bind the query parameter

    $stmt-> bind_param ('i', $_GET ['candidate_id']);

    run the query and fetch the result

    $OK = $stmt-> execute();

    $stmt-> bind_result ($position_id);

    Browse the results to store in a table

    $selected_positions = [];

    While ($stmt-> fetch() {)}

    [] $selected_positions = $position_id;

    }

    }

    find data on the position of the table

    $sql = ' SELECT position_id, position_number, title

    FROM place WHERE position_id =?';

    If ($stmt-> {prepared ($sql))}

    bind the query parameter

    $stmt-> bind_param ('i', $_GET [$position_id]);

    run the query and fetch the result

    $OK = $stmt-> execute();

    bind the results to variables

    $stmt-> bind_result ($position_id, $position_number, $title);

    Browse the results to store in a table

    $the_positions = [];

    While ($stmt-> fetch() {)}

    [] $the_positions = $position_id;

    }

    }

    Get the error message if the request fails

    If (isset ($stmt) & &! $OK) {}

    $error = $stmt-> error;

    }

    If (! $stmt) {}

    $error = $conn-> error;

    } else {}

    $numRows = $stmt-> num_rows;

    }

    ? >

    Thank you in advancel

    You want to use the value of request 1 or query2 as a parameter in the query 3, right? Rather than build a table, you can simply use the value returned by each line that the query returns. I use PDO, no MySQLi, so I can't knock out quickly the MySQLi example for you.

    While ($result = $sql-> fetch (PDP::FETCH_ASSOC)) {}
    $field = $result ['domain'];

    Now we can use the value of $field as parameter for the next query.

    The brace that closes the while loop is placed after the last query

    so no need to fill an array with values

    }

    Your approach is doable with a few changes to the way in which you go through the table, but it is unnecessarily complicated.

    You might be able to use a single query to get all the data if you use left joins. With this approach, you start with the table that SHOULD return a result or which requires no dependencies to other tables. The structure is like this:

    SELECT field1, Field2, field3 FROM (SELECT * FROM table1 WHERE field3 = param1) has

    LEFT JOIN (SELECT * FROM table2 WHERE A.field4 = table2.field4) B

    LEFT JOIN table3 ON table3.field5 = B.field5 ORDER BY Field1

    A and B above are aliases for subsets of the table. You can image a (tacit) sign = equal A

  • Cannot enter data on Web sites, can connect and discover, but not enter data

    I use Firefox for many years without any problems, but just recently, although I can connect to any site and discover anything, I can't enter data. For example if I type a comment on Facebook, I can't post, nothing happens. Similarly, I can make payments online through my line on the Bank's website. In the meantime, I use IE 11.0 instead of 35.0 Firefox but it's a nuisance. Any idea what could be the cause?

    Very strange, the problem is now gone, I can do messages and payments without problems that I mentioned at the outset. Only difference I can see, is that I now use Firefox 35.0.1. In any case, my problem disappeared, so I won't spend much time on development why it happened.
    However, thanks for the suggestion

  • How to transmit DATA between several state machines.

    Hi I'm doing a project that needs to acquire data from a simulated data file and display it on a graphical interface. Two of them are manufactured in a state machine. I wonder if it is a good way of communication of data between two state machines? It would be very appreciated if you can provide a few examples. Thank you very much.

    OK, there are plenty of ways to communicate, but who are these state machines in the same project? Same VI? All LabVIEW?

    I like functional global variables due to the functionality that can be included in the. If they are used wrongly, as most of the things with the coding, you will create the races and break your code.

    Work of local variable, but I try to clear them tsar when possible. If they are used wrongly, as most of the things with the coding, you will create the races and break your code.

    Queues are pretty popular to connect, but try to stay with fixed size data, if you think that the limits of memory could be a problem.

    If you speak through the eyes of network to published static Variables (do not use these unless you have a stable network) network, TCP/IP, UDP, or Web Services flow (you need experience in this field. It is not just together.

    LabVIEW is a good way to program, but this kind of key options.

  • Access the views Where the access to the underlying data, through a role

    I have a user (say User1) who granted select access to motherlode via a role table

    User1 has a bunch of useful views created I want User2 to have access to the. User2 should have access only to these points of view, not to the underlying table.

    User1 can grant access to his point of view because it has no direct access granted to motherlode tables.

    I managed, based on a technique that I have for the most part, but do not entirely understand, give User2 access to data through a function. The solution is below.

    My general question is: y at - it an easier way (other than the grant direct access to the motherlode User1 tables)?

    My question is: the definition is possible shorter somehow. I know I can automate the production of the code for some of the statements using metadata, but, for example, is it possible to base the declaration of type (t_p5) on the existing view? (I have about 15 views I need to provide access)

    Solution is, where v_p5 is the original view:

    User 1:

    CREATE or replace type t_p5 as an object

    (< columns and data types of v_p5 >

    )  ;

    CREATE or REPLACE TYPE t_p5_tab AS TABLE OF THE t_p5;

    FUNCTION to CREATE or REPLACE f_provide_p5 RETURN t_p5_tab

    PIPELINED IS

    l_cur SYS_REFCURSOR;

    l_rec v_p5% rowtype;

    BEGIN

    L_cur OPEN FOR ' SELECT * FROM v_p5';

    LOOP

    EXTRACTION l_cur

    IN l_rec;

    EXIT WHEN l_cur % NOTFOUND;

    GUIDELINE (t_p5 (area = > l_rec.region))

    , district_name = > l_rec.district_name

    , current_month = > l_rec.current_month

    , p_current = > l_rec.p_current

    , previous_month = > l_rec.previous_month

    , p_prev = > l_rec.p_prev

    , diffp = > l_rec.diffp

    , diff_perc = > l_rec.diff_perc

    , previous_year = > l_rec.previous_year

    , p_year = > l_rec.p_year

    , diffy = > l_rec.diffy

    , perc_diffy = > l_rec.perc_diffy

    ));

    END LOOP;

    RETURN;

    EXCEPTION

    WHILE OTHERS THEN

    raise_application_error (-20000, SQLERRM |) Chr (10) | l_sql);

    END;

    And user2:

    VIEW to CREATE or REPLACE v_p5 AS

    SELECT * FROM TABLE (User1.f_provide_p5);

    I can then do a select * from v_p5 in User2 and return the view data.

    Thank you.

    Hello

    Don't bother with the pipeline and PL/SQL functions.  Everything will be easier, more effective and more reliable if you use only views.

    Privileges through roles do not create a view on a table in another schema.

    If user1 can create a view on motherlode.table_x, then user1 should have direct privileges already (or user1 must have a privilege of system as SELECT ANY TABLE).

    User1 needs the same privileges WITH GRANT OPTION in order to grant privileges on his point of view to User2.  To do this, have motherlode grant privileges to user1, like this:

    GRANT SELECT ON table_x to User1 WITH GRANT OPTION;

    GRANT SELECT ON table_y to User1 WITH GRANT OPTION;

    Repeat for each table that user1 uses in the views.

    Then user1 will be able to grant privileges on views to User2 like this:

    GRANT SELECT ON my_view_01 TO user2.

    This will NOT allow user2 directly see the motherlode.table_x.  User1 will have the power to give privileges to User2, but simply grant privileges on the view does not give User2 these privileges.

    If you don't want User1 to have this power, then create the views in the motherlode scheme, or create a new schema only for the putpose to own these views.

  • We can enter data into the reporting currency?

    Hi Experts,

    Hyperion Planning version 11.1.2.2, classic Multi money demand.

    We have an obligation to enter data into the reporting currency. Is it possible in the schedule?

    For example... If we GBPand USD as currency statement, I have an obligation to enter data in GBP and USD for some entities.


    Kindly help me. !

    Thank you

    No you're not. In an application of multi currency GBP is a reporting currency. 'Local' is the local currency.

    All entities, regardless of their local currency, can enter data only in the "Local".

    Concerning

    Celvin

  • Loads of parallel data through SQL connect and replace existing data

    I'm doing a load of multiple data through SQL Connect using the following statement.  Just try to put in place a .bat file to automate the process but not sure that whenever it executes this statement adds data to existing or replaces the data? I tried to write an override for this but it works for instructions which contain the import section.

    Import of database data App.DB connect as username identified by password

    with the help of several rules_file, rul1, rul2, rul3

    load_buffer_block starting with buffer_id 10 on error write to 'C:\\dataload.err ';

    We can add spec commit buffer such as "replace all data ', 'create group', 'Add' to this import statement? The default declaration overrides the value whenever the data is loaded?

    Thanks in advance!

    you have an option in the rules file "Overwrite out of values."

    rulefile > setting dataload > loading values

  • Need help: not prepared statement to return the value:

    Hi refugees,

    In LICS, prepared statement does not return any value...

    This is the code...

    String p_person_id = pageContext.getParameter ("person_id");

    Connection Conn = pageContext.getApplicationModule (webBean) .getOADBTransaction () .getJdbcConnection ();

    String payment_query = "select max (payment_date) in the xxbdf_payslip_detail_mv where assingment_id = (select assignment_id from the people_reporting_info where person_id ' + p_person_id + ') ';

    PreparedStaement stmt = stmt.executeQuery ();

    ResultSet rs = stmt.executeQuery ();

    While ((rs! = null) & & RS.) Next

    {

    java.sql.Date sql_date = rs.getDate (1);

    SOP (SQL_DATE)

    / * I tried this also * /.

    java.util.Date util_date = rs.getDate (1);

    SOP();

    String string_date = rs.getString (1);

    SOP();

    }

    and I have to format the date as "DD-MM-RRRR.

    Please give your valuable suggestions refugees...

    Thank you

    Jaya

    Jaya Hey,

    Write the code below in the PR

    Code for the prepared statement


    String PaymentData;

    String p_person_id = pageContext.getParameter ("person_id");

    System.out.println ("The person Id is" + p_person_id); check the id of the person should not be null.

    try {}

    Connection Conn = pageContext.getApplicationModule (webBean) .getOADBTransaction () .getJdbcConnection ();

    String query = "select max (payment_date) in the xxbdf_payslip_detail_mv where assingment_id = (select assignment_id from the people_reporting_info where person_id ' + p_person_id + '); '

    PreparedStatement stmt = conn.prepareStatement (Query);

    ResultSet = stmt. ExecuteQuery();

    While (resultset.next ())

    {

    PaymentData = (String) resultset.getString("payment_date").toString ();

    }

    Conn.Commit ();

    }

    catch (System.Exception e)

    {

    e.printStackTrace ();

    }

    See below the Code for the Date Format Conversion


    cabu.ui.validate.Formatter formatter = new OADateValidater (PaymentData, "dd-MMM-YY" "");

    Thank you

    Dilip

  • How to restrict the user to enter data into the PLUGS DO

    Hello

    I textinput in my page, I have to restrict the user to enter the data covers only.

    can someone help me on this.

    Knockaert

    Please go through this site.

    http://oracleanil.blogspot.com/2010/10/restrict-user-to-enter-data-in-caps.html

    Concerning
    Meher Irk

  • Need to prevent the entity to enter data in the Profit Center that they do not have

    Hello

    We use the personal 2 dimension of Profit Center. The problem is that each entity has its own set of Profit Center. What would be the best way to prevent an entity to enter data in the profit center that didn't belong to him?


    I was thinking about a no. Input formula, but I don't want to write a rule for each entity, we have.

    Thank you

    If you insist to do using the noinput rules, then you must also provide the entity the noinput POV, for example:

    HS. NoInput ' E #L300.» "L001 # C2.

    Of course to do this dynamically you must loop through the entities as well and possibly play with corresponding string entity and profit center correspondence codes, but you should also keep in mind that the Administrator's manual recommends not not to use too much of a loop in the rules of noinput for performance reasons.

  • difficult to manually enter data into health

    with the last update apple has made it very difficult manually enter data into health app... I'm not talking about sugar in the blood or the weights every day entered manually as my personal info that does not normally change

    Launch the health application and then press update medical ID.

    For example, on your birthday, tap the box just to the right of the birth Date of edit.

    Use the app on your iPhone or iPod touch - Apple Support health

  • How can I enter data apple fitness?  I swim and take aerobics classes.  I don't wear my Apple Watch during this operation.

    How can I enter data of fitness on my Apple Watch?  I swim and take water aerobics classes and not wear my watch in the water.

    Hello

    It is not currently possible to enter data of fitness on Apple Watch.

    Health and fitness data Apple Watch, iPhone and any other source are rather grouped by health on your iPhone app. Combined data is reflected in the health app charts (which can be added to the dashboard), which adjust the results to avoid any double counting of data from different sources.

    To add a workout that has not been registered by your watch, iPhone, or other existing data source:

    -On your iPhone, in the application of health (icon: red heart on a white background), go to: data on health (tab) > Fitness > training > add a data Point > enter the result of your workout.

    Activity types available when you add a workout currently including swimming, but do not include aerobics (other can be used instead).

  • Comboxbox in the long term, already have the data case not able enter data same if U

    COMBOX Box is used to enter data at run time. "Allow Undefined strings" option enabled.

    Enter a given: "Abcde", it is stored in the list.

    Enter the data another: "ABcde" labview takes these data as "Abcde", its not to recognize the case-sensitive characters.

    Any suggestions or solutions to over come this problem.

    shrekt response illustrates the problem...

    The solution is to do a property node on the drop-down list box, select CaseSensitivePopup, and the value is false.

    Rod.

  • enter data in a 2D game table

    Hi all

    I am trying to enter data that is measured in real time in a set table size (I need to then put the data collected in a 3-d chart).

    The problem is when the data arrives, it can be read easily and placed in a 1 d table. But trying to input into a 2D array which index itself after reaching the last column of the table is rather difficult.

    I have attached the file that I use, but you won't be able to run it without the equipment that I use.

    I have attached a few images of the methods I've used and the results I get.

    2 me trying to find a way to index itself by chnaging indicates the line on which imputed data. However when the index line is chnaged during operation all data are transferred in before it the line, leaving the first line empty (as illustrated in 2 when the index changes)

    I did a variety of methods and looked online, but that's as close as I got.

    Thanks for any help,

    ALEXZ

    Pre-create the table outside the loop and simply divide the iteration of the loop by the number of columns and use the quotient and the remainder to the index in the array.

  • I am new to the ethernet communication using labview. I don't have any material. I have two laptop, I need to send and receive data through these 2 portable by using labview. Kindly help me on this.

    I am new to the ethernet communication using labview. I don't have any material. I have two laptop, I need to send and receive data through these 2 portable by using labview. Kindly help me on this.

    Dennis has already said: for a direct PC - PC connection, you need a cross over cable. If you connect through a router or a switch, you use a standard cable.

Maybe you are looking for

  • My external hard disk device files are hidden

    Hello! I use an external hard drive (Toshiba, USB 2.0) 320 and I have kept up to 160 GB data, but I didn't see any of it is to say the files I check the properties and it shows data from 162 used GB so how I recover my files. Please someone help me.

  • How to make photos of time play in a movie

    I figured out how to use the eos utility to make photos of time but how do I sting the pictures together to look at the time photos

  • I downloaded a game called fiesta, but he said nothing after download was complete! Why?

    I had a game called Fiesta installed on my lap top and had to uninstall and reinstall, but once the download is complete a box came say > file not found! I searched all my files and it is in a file called null! What is it and why is it in a file call

  • BB 10 Dev Simulator alpha prolem

    Helloo, I am a new developer, and I want to develop applications for BB 10. I already installed the NDK, installed Vmware plare, installed the Simulator. But how to start the Simulator. It shows the IP address of Simulator. What to fill that? NDK doe

  • Relocation of Smartphones blackBerry on curve 8300 software

    I'm trying to reinstall several programs that I have already uninstalled on my 8300 Curve. Downloaded programs are stored on my desk. I reinstalled the on my desk.  However, when I try to reinstall it on the Blackberry, the BlackBerry Desktop Manager