#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    4
    Rep Power
    0

    INSERT INTO statement and ordering the rows


    I have a "Insert into" statement and i need the resulting table to be ordered by PRED_STUD_ID. The parameter values are defined somewhere in the code. Does anybody know how to achieve this? Here is what i have, but it's not stored by any order.

    String sql = "INSERT INTO PREDMETSTUDENT (PRED_STUD_ID, PREDMETID, STUDENTID)"
    + "VALUES(:PRED_STUD_ID, :PREDMETID, :STUDENTID)";
    OracleCommand cmd = new OracleCommand();
    cmd.CommandText = sql;
    cmd.Parameters.AddWithValue(":PRED_STUD_ID", predstud_id + 1);
    cmd.Parameters.AddWithValue(":PREDMETID", Int32.Parse(selektiranPredmet));
    cmd.Parameters.AddWithValue(":STUDENTID", Int32.Parse(selektiranStudent));
  2. #2
  3. No Profile Picture
    Lost in code
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 2004
    Posts
    8,316
    Rep Power
    7171
    Ordering is done when you are retrieving data with a select query. You can't control the order that the rows are stored in.
    PHP FAQ

    Originally Posted by Spad
    Ah USB, the only rectangular connector where you have to make 3 attempts before you get it the right way around

IMN logo majestic logo threadwatch logo seochat tools logo