Inserting row in query

Can we insert new row after default result rows which can perform additional calculation without using structures.

Hi Janamk mehdi,
we can add any number of rows in ur Query designer panel.
thanks,
kiran

Similar Messages

  • Inserting empty row in query designer

    Hi Gurus
    Can any one advice me on how to insert a empty row in Query designer
    I'm using structure
    Thank you

    Refer - /thread/814122 [original link is broken]

  • Error while inserting rows in a table

    Hi,
    We have recently migrated from 9i to 10g. We have a scheduled job out our DB which first deletes all the rows from a table and then inserts them back by selecting rows from 5 tables. This table has a composite primary key based on 6 columns in it. In 9i, when i try to insert rows into the table after deleting all the rows from it, I am able to insert the data successfully . However, in 10g, when i try doing the same operation, it fails with the ORA error:
    ORA-00001: unique constraint violated
    The same query which works perfectly in 9i fails in 10g
    If anybody has some ideas on how to resolve the same, kindly let me know.
    Thanks in advance.

    Hi,
    I was finally able to resolve the reason behind that error message and found it even more weird. The error was because I was using the substr function for extracting the characters 1-4 from a column which is 5 characters long. When i specify the query as:
    select substr(column1, 1, 4)) from table1;
    only the characters 1-3 are retrieved. Now if i change the query to select substr(column1, 1, 5)) from table1, in that case also only 3 characters are retrieved although i have specified the substr to start from 1 and read till 5 characters. Also, when i run the query:
    select length(substr(column1, 1, 4)) from table1 or select length(substr(column1, 1, 5)) from table1
    I get the answer as 3.
    However, the most amazing part is that the query is working perfectly in 9i and is retrieving the data correctly i.e. from substr 1-4.
    Can anyone suggest what the problem could be?
    Thanks
    Edited by: CrazyAnie on May 13, 2009 1:34 AM

  • Help in inserting rows into a table

    I have a table called acct_fact,
    I need to insert rows in the table using a script but the problem is there's a column called seq_nbr which has random seq nbr of 14character length like 'ZWX98MGD9MVAD6J','ZWX98MG67RVAD6J' etc.,
    While inserting rows I need to generate such seq_nbr for those columns and insert rows into the table, can I use any such mechanism in my insert query to insert such random nbr's while inserting rows into a table.
    If so please suggest me

    Hi Peter,
    Thankyou for the quick reply:)
    can you suggest me how to implement it here in my script snippet:
    while read var_acct_nbr
    do
    echo "update acct_attr set acct_attr_exp_dt ='$ExpDate' where Acct_Attr_Value_Text='15' and acct_attr_exp_dt is null and person_id='LDCarrBillAgrm' and acct_nbr='$var_acct_nbr' ;" >> ./$DirectoryName/SQLQuery_$TimeStamp.sql
    echo "insert into acct_fact values ('$var_acct_nbr','$ExpDate','$ExpTime','*seq_nbr*','N','ProjTereza','Remoção de acordo d; data de expiração: $ExpDate',null,'1','LDE',null);" >> ./$DirectoryName/SQLQuery_$TimeStamp.sql
    done < ./$DirectoryName/ExpireAccts_$TimeStamp.LOG
    the script takes each acct_nbr nbr form a input file and fires an insert statement.
    The one in bold is the column where such sequence need to be inserted.can you help me in implementing the way you suggested in my script i.e., insert statement
    Thanks in Advance:)
    Edited by: rkrish on Jun 27, 2012 3:04 AM

  • ORA-01840 error on inserting row trough object browser

    Dear Oracle Community,
    I'm getting the ORA-01840: Input value not long enough for date format error when I try to insert a row with the date value 24-MAY-10 with my object browser.
    This is the problem column:
    Column Name | Data Type| Nullable| Default | Primary Key
    SIGNUPDATE |DATE |No | - | -
    Now this will look like I'm using the wrong date format so I have googled and found that I should use the following query to check for the correct date format my database uses.
    select * from nls_session_parameters where parameter = 'NLS_DATE_FORMAT';
    This returns the DD-MON-RR format so I think I'm inserting the correct date format here.
    What am I doing wrong?
    I have already tried inserting with the following formats and tried replacing the - sign with the / sign.
    DD-MON-RR
    DD-MON-YY
    DD-MON-YYYY
    I have also tried using the SYSDATE is in the DD-MON-RR format trough the SQL commandline.
    I'm feeling like an idiot this should be simple right?
    Please help me out here this is frustrating, many thanks in advance.
    J Nijman

    using the SYSDATE is in the DD-MON-RR format trough the SQL commandlineIn sqlplus try:
    insert into <tablename> ( <date columnname> [, ... ] ) values ( sysdate [, ...] );
    To get a sysdate date value added. Or specify the format string with a to_date expression:
    insert into <tablename> ( <date columnname> [, ... ] ) values ( to_date( '24-may-10', 'dd-mon-yy') [, ... ] );
    The engine isn't picky about separators agreeing with the format string, most any character in place of the '-' dash is acceptable.
    Now to get an ora-1840 out of the object browser (Table/Data/Insert Row), I'm not having any luck trying to duplicate that. With the default nls_date_format 'DD-MON-YY' even trying bad dates (i.e. 30-feb-10 or 30-feb-2010, or even 31-apr-10) it either does an ora-1839: date not valid for month specified, or with a four digit year it gives an ora-1830: date format picture ends before converting entire input string.
    Any RDBMS presents programmers with date and datetime challenges, its not just an oracle-frustration thing ;)

  • Transient VO insert error-Attempting to insert row with no matching EO base

    Hi ,
    I have a transient Vo (created using option - rows populated programmatically, not based on Query) and I need to uptade/insert rows in vo on click of a button.
    when i nsert row, i get following error
    oracle.jbo.InvalidOperException: JBO-26020: Attempting to insert row with no matching EO base
    This is what I am doing in my code
    ViewObject vo2 = am.findViewObject("TransientVO1");
    vo2.executeQuery();
    if (vo2 == null) {System.out.println("vo2 is null");}
    if (vo2 != null)
    System.out.println("in vo2 != null");
    Row row2 = vo2.createRow();
    row2.setAttribute("PlatformName", "ss");
    row2.setAttribute("UserName", "ss");
    vo.insertRow(row2);
    System.out.println(" vo2.getRowCount()"+ vo2.getRowCount());
    Why is it saying no EO base... is it mandatory to have EO for transient VO? Please help.
    Thanks

    The EO handles all DML, hence you need it if you have to set attributes in a VO. An EO handles the storage of a the single row (or part if your VO consists of multiple tables).
    You can try and overwrite the setter method of the attributes in ViewRowImpl class and store the changes somewhere else.
    Timo

  • Compare 2 tables and insert rows missing in each table.

    I have a tough situation. I have two exact tables- one online and one offline database. I know that there are missing rows of data from each table, so I need to make a comparison of one table and insert rows that do not exist. I was thinking to try this, but it took over 3 hours to run and did not return anything:
    insert into t
    select * from t a
    where not exists (select * from [email protected] b
    where a.col1 != b.col1
    and a.col2 != b.col2
    and a.col3 != b.col3);
    and it goes on for another 7columns.
    The trouble I have is to include a date clause so that the query can be broken down into running only a few months of data comparisions at a time- the records go back 4 years to compare. Also is there a way to write this so that it will query both tables at the same time in order to speed things up- or is one table at a time the best advice? Each table has over 100 million records to compare, that's why I was hoping to use a date criteria since one column is date.
    Let me know what you advise to make this work, I hope I was on the right track.

    Not sure if the MINUS operator will perform better with your data set but;
    SQL> create table t1 (some_id number, some_date date)
    Table created.
    SQL> create table t2 (some_id number, some_date date)
    Table created.
    SQL> insert into t1 values (1, trunc(sysdate))
    1 row created.
    SQL> insert into t1 values (2, trunc(sysdate-5))
    1 row created.
    SQL> insert into t1 values (4, trunc(sysdate-90))
    1 row created.
    SQL> insert into t2 values (1, trunc(sysdate))
    1 row created.
    SQL> insert into t2 values (3, trunc(sysdate-10))
    1 row created.
    SQL> insert into t2 values (5, trunc(sysdate-100))
    1 row created.
    SQL> select * from t1
       SOME_ID SOME_DAT
             1 07-07-30
             2 07-07-25
             4 07-05-01
    3 rows selected.
    SQL> select * from t2
       SOME_ID SOME_DAT
             1 07-07-30
             3 07-07-20
             5 07-04-21
    3 rows selected.
    SQL> insert into t1 (
       select some_id, some_date from t2 where some_date between sysdate-50 and sysdate
       minus
       select some_id, some_date from t1 where some_date between sysdate-50 and sysdate)
    1 row created.
    SQL> insert into t2 (
       select some_id, some_date from t1 where some_date between sysdate-50 and sysdate
       minus
       select some_id, some_date from t2 where some_date between sysdate-50 and sysdate)
    1 row created.
    SQL> select * from t1
       SOME_ID SOME_DAT
             1 07-07-30
             2 07-07-25
             4 07-05-01
             3 07-07-20
    4 rows selected.
    SQL> select * from t2
       SOME_ID SOME_DAT
             1 07-07-30
             3 07-07-20
             5 07-04-21
             2 07-07-25
    4 rows selected.

  • How to fetch last inserted row in MySQL

    Hi,
    I am trying to get the last inserted row in MySql..but not able to fetch it.
    this is what i used
    i have one column order_id which is auto_increment
    SELECT * FROM tablename WHERE order_id=(SELECT MAX(order_id) FROM tablename)
    any help is appreciated .
    the usage of lastinsert() method is also not successful
    chintan

    Hello
    Given you have a date column, you can use it to determine the latest row. However, there is still a chance that two rows were inserted at exactly the same time in which case you will need something in addition to your date column to decide which is the latest...
    The first option uses a sub query and the second uses analytics, as does the 3rd - however with the 3rd, if 2 rows have exactly the same date and time, it will pick one at random unless you include another column in the order by to determine the latest...
    select
    FROM
        your_table
    WHERE
        your_date_column = (SELECT MAX(your_date_column) from your_table)
    SELECT
    FROM
            select
                a.*,
                MAX(your_date_column) OVER() max_date_column
            FROM
                your_table a
    WHERE
        your_date_column = max_date_column
    SELECT
    FROM
            select
                a.*,
                ROW_NUMBER OVER(ORDER BY your_date_column DESC) rn
            FROM
                your_table a
    WHERE
        rn = 1HTH
    David

  • How to get the Interface inserted rows fom ODI Reporsitory

    hi,
    I need select query that will select the Interface inserted rows
    (Count) from ODI repository tables. because I want to maintain these records into another Oracle tables?????

    import datetime
    import sys
    import optparse
    document = []
    def docprint(string):
    document.append('%s' % string)n
    def docprintnocr(string):
    document.append('%s' % string)
    p = optparse.OptionParser()
    p.add_option('-a','--server',dest='server',default='XXX',help='The server with the ODI_W catalog')
    p.add_option('-b','--beginningday',dest='beginningday',type=int,default=1,help='The day to begin retrieval')
    p.add_option('-e','--endingday',dest='endingday',type=int,default=0,help='The day to end retrieval')
    p.add_option('-n','--session',dest='session',default='',help='Session to retrieve')
    p.add_option('-s','--step',dest='step',action='store_true',help='Print the step data')
    p.add_option('-t','--task',dest='task',action='store_true',help='Print the task data')
    p.add_option('-x','--recipientlist',dest='recipientlist',default='XXX',help='report recipient(s)')
    p.add_option('-y','--mailserver',dest='mailserver',default='XXX',help='mail server')
    p.add_option('-z','--mailuser',dest='mailuser',default='XXX',help='mail user')
    p.add_option('-p','--printonly',dest='printonly',action='store_true',help='Print, no e-mail')
    options,args = p.parse_args()
    docprint( '%s %s' \
    '\n\tserver=%s' \
    '\n\tbeginningday=%s' \
    '\n\tendingday=%s' \
    '\n\tsession=%s' \
    '\n\tstep=%s' \
    '\n\ttask=%s' \
    '\n\tprintonly=%s'
    sys.argv[0]
    ,datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
    ,options.server
    ,options.beginningday
    ,options.endingday
    ,options.session
    ,options.step
    ,options.task
    ,options.printonly
    if options.server.upper() in ('XXX','YYY'):
    catalog = 'ODI_W'
    elif options.server in ('WWW','ZZZ'):
    catalog = 'SNP_W'
    else:
    print 'Unknown server %s' % options.server
    sys.exit(1)
    TimeEnd = datetime.datetime.now() - datetime.timedelta(options.endingday)
    TimeBegin = datetime.datetime.now() - datetime.timedelta(options.beginningday)
    TimeFormat = '%Y-%m-%d %H:%M:%S'
    if options.task:
    options.step = True
    docprint( '\n%s between %s and %s' %(
    options.server
    ,TimeBegin.strftime(TimeFormat)
    ,TimeEnd.strftime(TimeFormat)
    OptionString = ''
    if options.session:
    OptionString = '\nPrinting session %s' % options.session
    else:
    OptionString = '\nPrinting all sessions'
    if options.step:
    OptionString = '%s %s' % (OptionString,'with step detail')
    if options.task:
    OptionString = '%s %s' % (OptionString, 'and task detail')
    docprint(OptionString)
    import pyodbc
    ConnectString = 'DRIVER={SQL SERVER};SERVER=%s;DATABASE=%s;Trusted_Connection=yes' % (options.server.upper(),catalog)
    try:
    Connection = pyodbc.connect(ConnectString,autocommit=False)
    Cursor = Connection.cursor()
    except Exception, e:
    raise RuntimeError, '%s %s connect failed\n%s' % (options.server,catalog,e)
    SelectSession = """
    select
    S.SESS_NO
    ,S.SESS_NAME
    ,S.SESS_BEG
    ,S.SESS_END
    ,coalesce(S.SESS_DUR,0)
    ,S.SESS_STATUS
    ,S.CONTEXT_CODE
    from SNP_SESSION as S
    where S.SESS_BEG between ? and ?
    and S.SESS_BEG = (
    select max(SESS_BEG)
    from SNP_SESSION
    where SESS_NAME = S.SESS_NAME)
    order by S.SESS_BEG ASC
    SelectSessionHistory = """
    select Top 3
    SESS_NO
    ,SESS_NAME
    ,SESS_BEG
    ,SESS_END
    ,coalesce(SESS_DUR,0)
    ,SESS_STATUS
    ,CONTEXT_CODE
    from SNP_SESSION
    where SESS_NAME = ?
    and SESS_NO <> ?
    order by SESS_BEG DESC
    SESS_NO = 0
    SESS_NAME = 1
    SESS_BEG = 2
    SESS_END = 3
    SESS_DUR = 4
    SESS_STATUS = 5
    CONTEXT_CODE = 6
    SelectStep = """
    select
    LOG.STEP_BEG
    ,LOG.STEP_END
    ,coalesce(LOG.STEP_DUR,0)
    ,LOG.STEP_STATUS
    ,coalesce(LOG.NB_ROW,0)
    ,coalesce(LOG.NB_INS,0)
    ,coalesce(LOG.NB_UPD,0)
    ,coalesce(LOG.NB_DEL,0)
    ,coalesce(LOG.NB_ERR,0)
    ,STEP.STEP_NAME
    ,STEP.NNO
    from SNP_STEP_LOG LOG
    inner join SNP_SESS_STEP STEP
    on STEP.SESS_NO = LOG.SESS_NO
    and STEP.NNO = LOG.NNO
    WHERE LOG.SESS_NO = ?
    ORDER BY STEP.NNO
    STEP_BEG = 0
    STEP_END = 1
    STEP_DUR = 2
    STEP_STATUS = 3
    NB_ROW = 4
    NB_INS = 5
    NB_UPD = 6
    NB_DEL = 7
    NB_ERR = 8
    STEP_NAME = 9
    STEP_NO = 10
    SelectTask = """
    select
    LOG.TASK_BEG
    ,LOG.TASK_END
    ,coalesce(LOG.TASK_DUR,0)
    ,LOG.TASK_STATUS
    ,coalesce(LOG.NB_ROW,0)
    ,coalesce(LOG.NB_INS,0)
    ,coalesce(LOG.NB_UPD,0)
    ,coalesce(LOG.NB_DEL,0)
    ,coalesce(LOG.NB_ERR,0)
    ,TASK.TASK_NAME3
    from SNP_SESS_TASK_LOG LOG
    inner join SNP_SESS_TASK TASK
    on TASK.SESS_NO = LOG.SESS_NO
    and TASK.NNO = LOG.NNO
    and TASK.SCEN_TASK_NO = LOG.SCEN_TASK_NO
    WHERE LOG.SESS_NO = ?
    AND LOG.NNO = ?
    ORDER BY LOG.SCEN_TASK_NO
    TASK_BEG = 0
    TASK_END = 1
    TASK_DUR = 2
    TASK_STATUS = 3
    TASK_ROW = 4
    TASK_INS = 5
    TASK_UPD = 6
    TASK_DEL = 7
    TASK_ERR = 8
    TASK_NAME = 9
    SessionStatuses = {'M':'Warning','E':'Err','D':'Done','R':'Run'}
    StepStatuses = {'M':'Warn','E':'Err','D':'Done','W':'Wait','R':'Run'}
    SessionRows =Cursor.execute(SelectSession,(TimeBegin,TimeEnd)).fetchall()
    for SessionRow in SessionRows:
    if options.session and options.session.upper() != SessionRow[SESS_NAME].upper():
    # Not requested
    continue
    if SessionRow[SESS_NAME] in ('SOCKETSERVER','PROCESSHUB'):
    # Skip these utilities
    continue
    if SessionRow[SESS_STATUS] == 'R':
    # Still running, nothing to print(
    docprint( '\n%s, status %s' % (
    SessionRow[SESS_NAME]
    ,SessionStatuses[SessionRow[SESS_STATUS]]
    continue
    if SessionRow[SESS_END]:
    SessionEnd = SessionRow[SESS_END].strftime(TimeFormat)
    else:
    SessionEnd = ' '
    SessionHistories = Cursor.execute(SelectSessionHistory,(SessionRow[SESS_NAME],SessionRow[SESS_NO])).fetchall()
    docprintnocr( '\n%-20s\n\t%s / %s %6i secs %s' % (
    SessionRow[SESS_NAME][:20]
    ,SessionRow[SESS_BEG].strftime(TimeFormat)
    ,SessionEnd
    ,SessionRow[SESS_DUR]
    ,SessionStatuses[SessionRow[SESS_STATUS]]
    for SessionHistory in SessionHistories:
    if SessionHistory[SESS_END]:
    SessionHistoryEnd = SessionHistory[SESS_END].strftime(TimeFormat)
    else:
    SessionHistoryEnd = ' '
    docprintnocr( '\t%s / %s %6i secs %s' % (
    SessionHistory[SESS_BEG].strftime(TimeFormat)
    ,SessionHistoryEnd
    ,SessionHistory[SESS_DUR]
    ,SessionStatuses[SessionHistory[SESS_STATUS]]
    if not options.step:
    # Step detail not requested
    continue
    docprint( '\n %-22s %5s %4s %8s %8s %8s %8s %8s' % (
    ,'Secs'
    ,'Stat'
    ,'Rows'
    ,'Inserts'
    ,'Updates'
    ,'Deletes'
    ,'Errors'
    for StepRow in Cursor.execute(SelectStep,SessionRow[SESS_NO]).fetchall():
    try:
    docprint( ' %-22s %5i %-4s %8i %8i %8i %8i %8i' % (
    StepRow[STEP_NAME][:22]
    ,StepRow[STEP_DUR]
    ,StepStatuses[StepRow[STEP_STATUS]]
    ,StepRow[NB_ROW]
    ,StepRow[NB_INS]
    ,StepRow[NB_UPD]
    ,StepRow[NB_DEL]
    ,StepRow[NB_ERR]))
    except Exception, e:
    docprint(e)
    continue
    if not options.task:
    # Task detail not requested
    continue
    try:
    for TaskRow in Cursor.execute(SelectTask,(SessionRow[SESS_NO],StepRow[STEP_NO])).fetchall():
    docprint( ' %-21s %5i %-4s %8i %8i %8i %8i %8i' % (
    TaskRow[TASK_NAME][:21]
    ,TaskRow[TASK_DUR]
    ,TaskRow[TASK_STATUS]
    ,TaskRow[TASK_ROW]
    ,TaskRow[TASK_INS]
    ,TaskRow[TASK_UPD]
    ,TaskRow[TASK_DEL]
    ,TaskRow[TASK_ERR]
    except Exception, e:
    docprint( e )
    docprint( '\nEnd of report')
    Connection.close()
    if options.printonly:
    for line in document:
    print line
    sys.exit(0)
    import smtplib
    Message = """From: %s
    To: %s
    MIME-Version: 1.0
    Content-type: text/html
    Subject: %s
    <font face="courier" size="4"><b>%s</b></font>
    options.mailuser
    ,options.recipientlist
    ,'Session Report'
    ,'<br>'.join(document).replace('\n','<br>').replace('\t',' ').replace(' ',' ')
    server = smtplib.SMTP(options.mailserver)
    server.sendmail(options.mailuser,options.recipientlist,Message)
    server.quit()

  • URGENT: How to see the inserted row results in the ResultSet after an insertRow()?

    I want to see the inserted row in my result set immediately after I do an insertRow(). I don't want to do another select as my table has 100,000 records. I am using TYPE_SCROLL_SENSITIVE and CONCUR_UPDATABLE resultset with 8.1.7 thin driver.
    May be the driver does not support this because dbmd.ownInsertsAreVisible(ResultSet.TYPE_SCROLL_SENSITIVE)) always returns false. I just want to know is there a workaround or any solution for this problem. I would really appreciate if somebody could help me. Thanks in advance.

    Okay, first execute the query reqd. Then make whatever filters, navigational changes etc that are reqd. Once you are satisfied with the view of the data that you see on the screen, then from the Bex toolbar, click the Save button (Second from left) and choose the option Save as View Global. Give it a decsription and technical name.
    Hope this helps...

  • Insert rows-failed

    Hi,
    Im using Oracle database 10g. Im in chap04 p.107. Im trying to insert a new row to the parts table. Here are the following statements and the result.
    DECLARE
    l_newId INTEGER := 6;
    l_newDesc VARCHAR2(250) := 'Mouse';
    BEGIN
    INSERT INTO parts
    (id, description, unitprice, onhand, reorder)
    VALUES ( l_newId, l_newDesc, 49, 1200, 500);
    END;
    Results      Explain      Describe      Saved SQL      History      
    1 row(s) inserted.
    0.32 seconds
    It says there that I was able to insert one row but when I tried to check it, its not there in the parts table. Here is my query and the result.
    select * from parts;
    ID     DESCRIPTION     UNITPRICE     ONHAND     REORDER
    1     Fax Machine     299     277     50
    2     Copy Machine     4895     143     25
    3     Laptop PC     2100     7631     1000
    4     Desktop PC     1200     5903     1000
    5     Scanner     99     490     200
    5 rows returned in 0.07 seconds     
    The new inserted row is still not in the table.
    What do I do to really insert this newId in the parts table? I need some help pls. I will be patiently waiting for some answers. Thank you very much.
    lyn

    Hi,
    Thank you so much for your reply. Its working right now.
    Happy New year. Thank you once again.
    Godbless,
    lyn

  • Need help with inserting rows in ResultSet and JTable

    hello Guru!
    i have inserted a row in my result set and i want that my table shows this row promptly after i have inserted it in my result set...
    but when i use following code for my resultset:
    rs.moveToInsertRow();
    rs.updateInt(1,nr);
    rs.updateString(2, name);
    rs.insertRow();
    Record are inserted in resultset and database but not shown in my JTable??
    Anyone a Clue to without reexecuting the query how can i display inserted row in JTable
    http://download-west.oracle.com/docs/cd/A87860_01/doc/java.817/a83724/resltse7.h
    I have refrered the following links but still clue less help Guruuuuuuu
    i m really in trobble??????

    i am just near by the Solution using the Database Metadata
    by couldn't get the ideaaaa
    ==================================================
    http://download-west.oracle.com/docs/cd/A87860_01/doc/java.817/a83724/resltse7.htm
    Seeing Database Changes Made Internally and Externally
    This section discusses the ability of a result set to see the following:
    its own changes (DELETE, UPDATE, or INSERT operations within the result set), referred to as internal changes
    changes made from elsewhere (either from your own transaction outside the result set, or from other committed transactions), referred to as external changes
    Near the end of the section is a summary table.
    Note:
    External changes are referred to as "other's changes" in the Sun Microsystems JDBC 2.0 specification.
    Seeing Internal Changes
    The ability of an updatable result set to see its own changes depends on both the result set type and the kind of change (UPDATE, DELETE, or INSERT). This is discussed at various points throughout the "Updating Result Sets" section beginning on , and is summarized as follows:
    Internal DELETE operations are visible for scrollable result sets (scroll-sensitive or scroll-insensitive), but are not visible for forward-only result sets.
    After you delete a row in a scrollable result set, the preceding row becomes the new current row, and subsequent row numbers are updated accordingly.
    Internal UPDATE operations are always visible, regardless of the result set type (forward-only, scroll-sensitive, or scroll-insensitive).
    Internal INSERT operations are never visible, regardless of the result set type (neither forward-only, scroll-sensitive, nor scroll-insensitive).
    An internal change being "visible" essentially means that a subsequent getXXX() call will see the data changed by a preceding updateXXX() call on the same data item.
    JDBC 2.0 DatabaseMetaData objects include the following methods to verify this. Each takes a result set type as input (ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_SENSITIVE, or ResultSet.TYPE_SCROLL_INSENSITIVE).
    boolean ownDeletesAreVisible(int) throws SQLException
    boolean ownUpdatesAreVisible(int) throws SQLException
    boolean ownInsertsAreVisible(int) throws SQLException
    Note:
    When you make an internal change that causes a trigger to execute, the trigger changes are effectively external changes. However, if the trigger affects data in the row you are updating, you will see those changes for any scrollable/updatable result set, because an implicit row refetch occurs after the update.
    Seeing External Changes
    Only a scroll-sensitive result set can see external changes to the underlying database, and it can only see the changes from external UPDATE operations. Changes from external DELETE or INSERT operations are never visible.
    Note:
    Any discussion of seeing changes from outside the enclosing transaction presumes the transaction itself has an isolation level setting that allows the changes to be visible.
    For implementation details of scroll-sensitive result sets, including exactly how and how soon external updates become visible, see "Oracle Implementation of Scroll-Sensitive Result Sets".
    JDBC 2.0 DatabaseMetaData objects include the following methods to verify this. Each takes a result set type as input (ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_SENSITIVE, or ResultSet.TYPE_SCROLL_INSENSITIVE).
    boolean othersDeletesAreVisible(int) throws SQLException
    boolean othersUpdatesAreVisible(int) throws SQLException
    boolean othersInsertsAreVisible(int) throws SQLException
    Note:
    Explicit use of the refreshRow() method, described in "Refetching Rows", is distinct from this discussion of visibility. For example, even though external updates are "invisible" to a scroll-insensitive result set, you can explicitly refetch rows in a scroll-insensitive/updatable result set and retrieve external changes that have been made. "Visibility" refers only to the fact that the scroll-insensitive/updatable result set would not see such changes automatically and implicitly.
    Visibility versus Detection of External Changes
    Regarding changes made to the underlying database by external sources, there are two similar but distinct concepts with respect to visibility of the changes from your local result set:
    visibility of changes
    detection of changes
    A change being "visible" means that when you look at a row in the result set, you can see new data values from changes made by external sources to the corresponding row in the database.
    A change being "detected", however, means that the result set is aware that this is a new value since the result set was first populated.
    With Oracle8i release 8.1.6 and higher, even when an Oracle result set sees new data (as with an external UPDATE in a scroll-sensitive result set), it has no awareness that this data has changed since the result set was populated. Such changes are not "detected".
    JDBC 2.0 DatabaseMetaData objects include the following methods to verify this. Each takes a result set type as input (ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_SENSITIVE, or ResultSet.TYPE_SCROLL_INSENSITIVE).
    boolean deletesAreDetected(int) throws SQLException
    boolean updatesAreDetected(int) throws SQLException
    boolean insertsAreDetected(int) throws SQLException
    It follows, then, that result set methods specified by JDBC 2.0 to detect changes--rowDeleted(), rowUpdated(), and rowInserted()--will always return false with the 8.1.6 Oracle JDBC drivers. There is no use in calling them.
    Summary of Visibility of Internal and External Changes
    Table 12-1 summarizes the discussion in the preceding sections regarding whether a result set object in the Oracle JDBC implementation can see changes made internally through the result set itself, and changes made externally to the underlying database from elsewhere in your transaction or from other committed transactions.
    Table 12-1 Visibility of Internal and External Changes for Oracle JDBC
    Result Set Type Can See Internal DELETE? Can See Internal UPDATE? Can See Internal INSERT? Can See External DELETE? Can See External UPDATE? Can See External INSERT?
    forward-only
    no
    yes
    no
    no
    no
    no
    scroll-sensitive
    yes
    yes
    no
    no
    yes
    no
    scroll-insensitive
    yes
    yes
    no
    no
    no
    no
    For implementation details of scroll-sensitive result sets, including exactly how and how soon external updates become visible, see "Oracle Implementation of Scroll-Sensitive Result Sets".
    Notes:
    Remember that explicit use of the refreshRow() method, described in "Refetching Rows", is distinct from the concept of "visibility" of external changes. This is discussed in "Seeing External Changes".
    Remember that even when external changes are "visible", as with UPDATE operations underlying a scroll-sensitive result set, they are not "detected". The result set rowDeleted(), rowUpdated(), and rowInserted() methods always return false. This is further discussed in "Visibility versus Detection of External Changes".
    Oracle Implementation of Scroll-Sensitive Result Sets
    The Oracle implementation of scroll-sensitive result sets involves the concept of a window, with a window size that is based on the fetch size. The window size affects how often rows are updated in the result set.
    Once you establish a current row by moving to a specified row (as described in "Positioning in a Scrollable Result Set"), the window consists of the N rows in the result set starting with that row, where N is the fetch size being used by the result set (see "Fetch Size"). Note that there is no current row, and therefore no window, when a result set is first created. The default position is before the first row, which is not a valid current row.
    As you move from row to row, the window remains unchanged as long as the current row stays within that window. However, once you move to a new current row outside the window, you redefine the window to be the N rows starting with the new current row.
    Whenever the window is redefined, the N rows in the database corresponding to the rows in the new window are automatically refetched through an implicit call to the refreshRow() method (described in "Refetching Rows"), thereby updating the data throughout the new window.
    So external updates are not instantaneously visible in a scroll-sensitive result set; they are only visible after the automatic refetches just described.
    For a sample application that demonstrates the functionality of a scroll-sensitive result set, see "Scroll-Sensitive Result Set--ResultSet5.java".
    Note:
    Because this kind of refetching is not a highly efficient or optimized methodology, there are significant performance concerns. Consider carefully before using scroll-sensitive result sets as currently implemented. There is also a significant tradeoff between sensitivity and performance. The most sensitive result set is one with a fetch size of 1, which would result in the new current row being refetched every time you move between rows. However, this would have a significant impact on the performance of your application.
    how can i implement this using
    JDBC 2.0 DatabaseMetaData objects include the following methods to verify this. Each takes a result set type as input (ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_SENSITIVE, or ResultSet.TYPE_SCROLL_INSENSITIVE).
    boolean deletesAreDetected(int) throws SQLException
    boolean updatesAreDetected(int) throws SQLException
    boolean insertsAreDetected(int) throws SQLException

  • Inserting rows into table Based on Column Values.

    Hi,
    I am trying to inserting rows into a table based on Column.
    Id      Name        
    Data
    N 105.1.1
    http://www.example.com/New/105.1.1
    U 105.1.2               http://www.example.com/Used/105.1.2
    S 105.1.3               http://www.example.com/Sold/105.1.3
    I want a table like this. 
    I want to insert Data column value based on Id and Name Columns
    If Id = N and Name = 105.1.1 then Data value should be insert as   http://www.example.com/New/105.1.1
    If Id = U and Name = 105.1.2 then Data value should be  insert as  http://www.example.com/Used/105.1.2
    If Id = S and Name = 105.1.3 then Data value should be insert as   http://www.example.com/Sold/105.1.3
    Can you please help us to write query to insert above Data Column values based on Id and Name Columns.

    INSERT INTO tbl (col) SELECT
    CASE WHEN id='N' and Name='105.1.1 ' THEN 'http://www.example.com/New/105.1.1'
              WHEN id='U' and Name='105.1.2 ' THEN 'http://www.example.com/New/105.1.2'
    END col
    FROM anothertbl
    Sorry , cannot test it right now.
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • Adding 2 more rows to a select without inserting rows to base table

    hello all,
    i have a below simple select statement which is querying a table.
    select * from STUDY_SCHED_INTERVAL_TEMP
    where STUDY_KEY = 1063;
    but here is the situations. As you can see its returning 7 rows. But i need to add
    2 more rows..with everything else default value or what exist... except adding 2 more rows.
    i cannot insert into base table. I want my end results to increment by 2 days in
    measurement_date_Taken to 01-apr-09....so basically measurement_date_taken should
    end at study_end_Date...
    IS THAT EVEN POSSIBLE WITHOUT INSERTING ROWS INTO THE TABLE AND JUST PLAYIHY AROUND WITH
    THE SELECT STATEMENT??
    sorry if this is confusing...i am on 10.2.0.3
    Edited by: S2K on Aug 13, 2009 2:19 PM

    Well, I'm not sure if this query looks as good as my lawn, but seems to work anyway ;)
    I've used the 'simplified version', but the principle should work for your table to, S2K.
    As Frank already pointed out (and I stumbled upon it while clunging): you just select your already existing rows and union them with the 'missing records', you calculate the number of days you're 'missing' based on the study_end_date:
    MHO%xe> alter session set nls_date_language='AMERICAN';
    Sessie is gewijzigd.
    Verstreken: 00:00:00.01
    MHO%xe> with t as ( -- generating your data here, simplified by me due to cat and lawn
      2  select 1063 study_key
      3  ,      to_date('01-MAR-09', 'dd-mon-rr') phase_start_date
      4  ,      to_date('02-MAR-09', 'dd-mon-rr') measurement_date_taken
      5  ,      to_date('01-APR-09', 'dd-mon-rr') study_end_date
      6  from dual union all
      7  select 1063, to_date('03-MAR-09', 'dd-mon-rr') , to_date('04-MAR-09', 'dd-mon-rr') , to_date('01-APR-09', 'dd-mon-rr') from dual union all
      8  select 1063, to_date('03-MAR-09', 'dd-mon-rr') , to_date('09-MAR-09', 'dd-mon-rr') , to_date('01-APR-09', 'dd-mon-rr') from dual union all
      9  select 1063, to_date('03-MAR-09', 'dd-mon-rr') , to_date('14-MAR-09', 'dd-mon-rr') , to_date('01-APR-09', 'dd-mon-rr') from dual union all
    10  select 1063, to_date('03-MAR-09', 'dd-mon-rr') , to_date('19-MAR-09', 'dd-mon-rr') , to_date('01-APR-09', 'dd-mon-rr') from dual union all
    11  select 1063, to_date('22-MAR-09', 'dd-mon-rr') , to_date('23-MAR-09', 'dd-mon-rr') , to_date('01-APR-09', 'dd-mon-rr') from dual union all
    12  select 1063, to_date('22-MAR-09', 'dd-mon-rr') , to_date('30-MAR-09', 'dd-mon-rr') , to_date('01-APR-09', 'dd-mon-rr') from dual
    13  ) -- actual query:
    14  select study_key
    15  ,      phase_start_date
    16  ,      measurement_date_taken
    17  ,      study_end_date
    18  from   t
    19  union all
    20  select study_key
    21  ,      phase_start_date
    22  ,      measurement_date_taken + level -- or rownum
    23  ,      study_end_date
    24  from ( select study_key
    25         ,      phase_start_date
    26         ,      measurement_date_taken
    27         ,      study_end_date
    28         ,      add_up
    29         from (
    30                select study_key
    31                ,      phase_start_date
    32                ,      measurement_date_taken
    33                ,      study_end_date
    34                ,      study_end_date - max(measurement_date_taken) over (partition by study_key
    35                                                                          order by measurement_date_taken ) add_up
    36                ,      lead(measurement_date_taken) over (partition by study_key
    37                                                          order by measurement_date_taken ) last_rec
    38                from   t
    39              )
    40         where last_rec is null
    41       )
    42  where rownum <= add_up
    43  connect by level <= add_up;
    STUDY_KEY PHASE_START_DATE    MEASUREMENT_DATE_TA STUDY_END_DATE
          1063 01-03-2009 00:00:00 02-03-2009 00:00:00 01-04-2009 00:00:00
          1063 03-03-2009 00:00:00 04-03-2009 00:00:00 01-04-2009 00:00:00
          1063 03-03-2009 00:00:00 09-03-2009 00:00:00 01-04-2009 00:00:00
          1063 03-03-2009 00:00:00 14-03-2009 00:00:00 01-04-2009 00:00:00
          1063 03-03-2009 00:00:00 19-03-2009 00:00:00 01-04-2009 00:00:00
          1063 22-03-2009 00:00:00 23-03-2009 00:00:00 01-04-2009 00:00:00
          1063 22-03-2009 00:00:00 30-03-2009 00:00:00 01-04-2009 00:00:00
          1063 22-03-2009 00:00:00 31-03-2009 00:00:00 01-04-2009 00:00:00
          1063 22-03-2009 00:00:00 01-04-2009 00:00:00 01-04-2009 00:00:00
    9 rijen zijn geselecteerd.If there's a simpler way (in SQL), I hope others will join and share their example/ideas/thoughts.
    I have a feeling that this is using more resources than needed.
    But I've got to cut the daisies first now, they interfere my 'lawn-green-ess' ;)

  • How to retrieve the last inserted row

    This may be a question with a very known answer but I couldn't find any within this forum.
    What is the proper way to retrieve the just inserted record ?
    I'm accessing the DB from external Java and at this moment I use a timestamp column in order to retrieve the inserted row. So I generate an unique timestamp ('20020615184524356') which I inserted during the insert operation. I retrieve the just inserted row using "select * from fooTable where(timestamp='20020615184524356')".
    Is this the general idea or am I totally wrong ?

    hi Shaik Khaleel,
    Just wanted to clarify my doubts regarding rowid.
    Please refer the subject as "abt rowid" in previous posting and ur reply for that was
    "its an unique number throughout the database, its an hexadecimal number. it assigns the rowid of the deleted row in future , but not to the immediate insertation row."
    As u have mentioned the rowid of the deleted row can be assigned to a new row in future,
    wont the following query fail.
    select * from temp where rowid=(select max(rowid) from temp); -- in oracle. ~chandru

Maybe you are looking for

  • My experiences of importing different formats into IMovie...!!

    I’ve been through a lot of pain with IMovie for the last 6 months, and cracked it a couple of days ago. I therefore feel the need to write about my experiences. I have lots of old footage on:- 1. DV tape 2. HI8 tapes 3. Sony mini-DVDs 4. DVDs 5. Sony

  • IPhone 3GS not connecting with iTunes 10.1.1.4

    Hey all, I'm having a rather peculiar problem. Recently I had to do a factory restore of my HP Pavilion dv6, and I proceeded to download the latest version of iTunes. Whenever I try to sync my iPhone 3GS, it doesn't show up. Yes, I've tried everythin

  • Wrk54g router setup

    Everything works fine when I disable WEP.  When I enable WEP and insert the key when connecting an error message comes up limited or no connectivity.  As a result I can't connect to the internet.  I have enabled the mac filter to give me some sort of

  • Is iMac G5 (no iSight) harddrive interchangable with Intel iMac (white)?

    I have a new (used) Intel iMac, and I'd like to put the harddrive from an iMac G5 (no iSight) into it. Do both these computers use the same type of harddrive? Can I just swap them? Thanks.

  • Go_item(:detail.item) after query(F7) in master, frm-40737

    Dear friends, I have a master block and a detail block. When the master block ist queried, I want to go to a disticnt item in detail block, if there are records. Therefore I tried to put code in the post_query of the detail_block, which caused error