Select query resulting in redo?

Hi All,
Does select query results in redo? In what cases this happens?
Regards,
Sphinx

mtefft wrote:
Another possibility is that the SELECT query invokes a PL/SQL function that performs insert, update or delete.
This is a poor practice for a number of reasons but they are out there.
Disagree with that. Proof:
SQL> create table x(y number);                                   
Table created.                                                   
SQL> create function f return number as                          
  2  begin                                                       
  3  insert into x values (2);                                   
  4  return 1;                                                   
  5  end;                                                        
  6  /                                                           
Function created.                                                
SQL> select dummy, f() from dual;                                
select dummy, f() from dual                                      
ERROR at line 1:                                                 
ORA-14551: cannot perform a DML operation inside a query         
ORA-06512: at "HR.F", line 3                                     

Similar Messages

  • How to insert the select query result into table?

    How to insert the select query result into table?
    SELECT  top 20 creation_time  
            ,last_execution_time 
            ,total_physical_reads
            ,total_logical_reads  
            ,total_logical_writes
            , execution_count 
            , total_worker_time
            , total_elapsed_time 
            , total_elapsed_time / execution_count avg_elapsed_time
            ,SUBSTRING(st.text, (qs.statement_start_offset/2) + 1,
             ((CASE statement_end_offset 
              WHEN -1 THEN DATALENGTH(st.text)
              ELSE qs.statement_end_offset END 
                - qs.statement_start_offset)/2) + 1) AS statement_text
    FROM sys.dm_exec_query_stats AS qs
    CROSS APPLY sys.dm_exec_sql_text(qs.sql_handle) st
    ORDER BY total_elapsed_time / execution_count DESC;
    Thanks,
    Tirumala

    1. SELECT INTO
    Below method will create table when data is inserted from one table to another table. Its useful when you need exactly same datatype as source table.
    Use AdventureWorks2008R2;
    Go
    ---Insert data using SELECT INTO
    SELECT AddressLine1, City
    INTO BothellAddresses
    FROM Person.Address
    where City = 'Bothell';
    GO
    ---VERIFY DATA
    Select AddressLine1, City
    FROM BothellAddresses
    ---DROP TABLE
    DROP TABLE BothellAddresses
    GO
    2. INSERT INTO SELECT
    Below method will need table to be created prior to inserting data. Its really useful when table is already created and you want insert data from
    another table.
    Use AdventureWorks2008R2;
    Go
    ---Create Table
    CREATE TABLE BothellAddresses (AddressLine1 NVARCHAR(60), City NVARCHAR(30))
    ---Insert into above table using SELECT
    INSERT INTO BothellAddresses(AddressLine1, City)
    SELECT AddressLine1, City
    FROM Person.Address
    where City = 'Bothell';
    ---VERIFY DATA
    Select AddressLine1, City
    FROM BothellAddresses
    ---DROP TABLE
    DROP TABLE BothellAddresses
    GO
    Regards,
    Vishal Patel
    Blog: http://vspatel.co.uk
    Site: http://lehrity.com

  • Select query result set order

    Hi,
    Can I know the order in which Oracle outputs the result set of a simple SELECT query ? Will the output always be same as the order in which rows got inserted ?
    Please advise,
    Thanks,
    Smitha

    If you include an ORDER BY than the order of the result set is known.
    It will not always be the same as the order in which rows got inserted.

  • Select query results into excel file

    Hi,
    I want to put the results of a select query in an csv file(tab separated columns). I dont want to spool command for this . Is there any other method to do this.
    Thanks

    To get data from oracle to excel to use odbc driver to achive this.

  • Select Query Results to a .csv file????

    Hello All,
    I have a question in Oracle, if anyone knows how to do this. Please help me.
    How can I get the results of select query in Oracle loaded into a Excel file (.csv) file.
    Thanks in Advance,
    Sarada.

    Hi Sarada,
    as a csv is nothing more than a list of Comma Separated Values your best shot is to simply read do this with your values. read each value in an iteration add them to a string / stringbuffer and add a "," between them. When you read then next line in the ResultSet you just add a carriage return to the end. Depending on what format you want your csv list in.
    After you written all of this into a String you write this out to a file (unless you want to do it slower and write them line by line whenever you read them).
    Hope this helps,
    Kalle

  • Select Query resulting in Scientific Notation

    Hello all,
    I am running a Select query through a batch file that extracts data from an Oracle database. Several of the fields that I am extracting from contain numbers that are up to 38 digits long. When I extract the data, it converts the numbers into scientific notation and it is important for me to have the entire field. Is there something I can change to my query that will pull the data in its entire form? This is what I'm running now:
    select * FROM ML.APPT where APPTDATE >= to_date('01/1/2010','mm/dd/yyyy'
    I apologize in advance if this has been answered already.
    Thanks!

    >
    When the extractor finishes, it returns the data into a flat file.
    don't quite understand the TO_CHAR function. Does this function mean I need to say something like this: select "TO_CHAR('column name', 99999999999999999999999999999999999999" FROM ML.APPT where APPTDATE >= to_date('01/1/2010','mm/dd/yyyy')
    >
    Yes- if the tool you use to extract the data (your 'extractor') is converting the numeric data to a string then it is responsible for creating the string in the proper format. If the number is an integer that can have as many digits as you have '9's in your sample format string then that is what you need to do.
    Here is how sql*plus (Oracle's tool) will display the data using default settings
    SQL> select 12345678901234567890123456789012345678 no_format,
      2  to_char(12345678901234567890123456789012345678, '99999999999999999999999999
    999999999999') with_format
      3   from dual;
    NO_FORMAT WITH_FORMAT
    1.2346E+37  12345678901234567890123456789012345678
    SQL>
    ----- TOAD will display something similiar but the default uses more decimal digits in the scientific notation data
    NO_FORMAT,WITH_FORMAT
    1.23456789012346E37, 12345678901234567890123456789012345678You can either format the numeric data in the query using TO_CHAR or the 'extractor' can do it when it converts the data to a string.

  • Problem with select query (results cant b displayed)

    SELECT url,SUM(data_received) xyz FROM logs GROUP BY url ORDER BY xyz desc
    when i triedthe above query in the worksheet it works fine but when i write same query in code i get this error.
    myjsp page has this code.
    <%while (rset.next())
    out.println("<tr>");
    out.println("<td>" +
    rset.getString(1) + "</td><td>" +
    rset.getInt(2) + "</td><td> " +
    "</td>");
    out.println("<tr>");
    %>
    This is the error
    500 Internal Server Error
    java.sql.SQLException: Invalid column name at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:138) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:175) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:240) at oracle.jdbc.driver.OracleStatement.get_column_index(OracleStatement.java:3201) at oracle.jdbc.driver.OracleResultSetImpl.findColumn(OracleResultSetImpl.java:1880) at oracle.jdbc.driver.ScrollableResultSet.findColumn(ScrollableResultSet.java:1308) at oracle.jdbc.driver.OracleResultSet.getInt(OracleResultSet.java:1618) at list_action._jspService(_list__action.java:67) [list_action.jsp] at com.orionserver[Oracle Containers for J2EE 10g (10.1.3.0.0) ].http.OrionHttpJspPage.service(OrionHttpJspPage.java:60) at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:416) at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:478) at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:401) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:719) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:376) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:870) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:451) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:218) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.run(HttpRequestHandler.java:119) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.run(HttpRequestHandler.java:112) at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260) at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:230) at oracle.oc4j.network.ServerSocketAcceptHandler.access$800(ServerSocketAcceptHandler.java:33) at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:831) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303) at java.lang.Thread.run(Thread.java:595)
    please help

    it is better to use  into table ....itab.
    dont go for joins if u r joining four tables .......
    it is better to for all entries.
    SELECT aauart awerks akdauf akdpos
    bftrmi baufnr bstlbez baufpl
    blead_aufnr bprodnet
    FROM aufk AS a
    INNER JOIN afko AS b
    ON baufnr EQ aaufnr
    INTO  TABLE i_data1
    WHERE a~auart IN s_auart
    AND a~kdauf IN s_vbeln
    AND a~werks EQ p_werks
    AND b~aufnr IN s_aufnr
    AND b~ftrmi IN s_ftrmi.
    if i_data1[] is not initial .
    if any sorting criteria is required based on primary keys write the sort statement here.
    select  crueck crmzhl
    cvornr carbid clmnga cxmnga
    crmnga cism04 cism05 cbudat
    d~kunnr
    e~arbpl
    FROM afru AS c inner join vbak AS d
    ON caufnr EQ aaufnr  innerjoin  crhd AS e
    like this u need to do...........................
    u have joined around five tables ...definetly that wont work
    endif.

  • CF9 Problems with Select * query, resulting in Value can not be converted to requested type.

    So, I work on a legacy CF web site and there are numerous SELECT * FROM USERS_TABLE queries all over the site.
    Well, we changed the structure of said table in the database on our Testing and Staging sites, with no issues.
    When we pushed up to our production environment and changed the structure of the production DB table, the server kept kicking back "Value can not be converted to requested type."
    After doing some searching out there, it looks like CF caches the structure of the table, and you either have to restart CF to clear it, or rename and then name-back the DSN to fix the issue.
    http://www.bennadel.com/blog/194-ColdFusion-Query-Error-Value-Can-Not-Be-Converted-To-Requ ested-Type.htm
    That said, this doesn't happen in our testing and staging environments - so what would be the difference?
    Is there some setting I need to change in the CF Admin to keep this from happening again?

    Also, if you can use a Stored Procedure to retrieve the data, do so.  Standard queries gets all the information, anyway, chokes bandwidth passing it all to the CF server, and forces the CF server to filter, sort, and format the data.  SPs tell the db server to get ONLY the data requested, and forces the db server to filter and sort the data, leaving only formatting to the CF server.
    That's not true. The only time CF messes with data returned from the DB is if there's a maxrows attribute, and the record set returnded from the DB has more than that number of records... which causes CF to truncate the recordset to the correct size before returning it. The DB might or might not stop sending rows down to CF after CF says "yeah, I've got all I want now".
    Other than that, for all intents and purposes all CF does with the SQL is pass it to the DB and wait for an answer. The only thing it does to the returned data is to create a CF record set ("query") with it... this does not involve any filtering and sorting.
    Adam

  • Difference in count(*) query and select * query results

    i am using Oracle9i Enterprise Edition Release 9.2.0.8.0.
    in a table select count(*) returns 34, but when i run select * statement it returns only 6 rows. Results are pasted below. Can any one knows the reason of this mismatch
    SQL> select * from pay_at;
    EMP_CODE STA IN_OUT_DA TIME
    100341 IN 07-MAR-04 09:32
    100341 OUT 07-MAR-04 10:24
    103165 IN 31-MAR-03 14:41
    103165 OUT 31-MAR-03 20:00
    101204 IN 19-APR-04 13:00
    101204 OUT 19-APR-04 23:59
    6 rows selected.
    SQL> select count(*) from pay_at;
    COUNT(*)
    34
    ------------------------------------------------------

    Maybe you pressed CTRL-c during the fetch phase of "select * from" ?
    If this is not the case, try to build a very small test case we can run that shows this behaviour and post it here.
    Regards,
    Rob.

  • Show Select query result in the text file.

    Hi all,
    i want to show my select statment records in the text file.
    thanks in advance.
    Mob.

    you cannot do a select in a stored procedure.
    you could do something like
    SQL> set serverout on
    SQL> spool output.txt
    SQL> declare
           x varchar2(40);
         begin
           select * into x from dual;
           dbms_output.put_line(x);
         end;
    X
    SQL> spool offor use the utl_file package (more powerfull, less secure, write on the db-server instead of the sqlplus-client)

  • 2.1EA2: Pinning Query Results and changing Connections [fixed in 2.1.0]

    I am on 2.1EA2 (JDK 1.6.0_16) and been playing with the new SQL Worksheet pin query results functionality. I have found that it is possible to run a query against one connection, pin the results and then change connection and run the same (or a different) query against another connection. I really like this, but found a few problems:
    #1 There doesn't seem to be any way to tell which connection a query result tab was actually run against
    #2 Even if all rows are fetched, if I then disconnect from the first connection it can get quite messy. Sometimes I get an empty connection dialog (I can't remember the exact title and it doesn't reproduce consistently) with only the close window X in the corner. Some times I get prompted to log in with a connection information dialog with no reference to the connection it is connecting to - cancelling only brings up the same dialog again until I successfully connect. Some times I get prompted to log in and while that is still on the screen, SQL Developer logs me back in to the connection (even though I don't save passwords) - I even get a new worksheet for the reconnected connection.
    theFurryOne

    Raghu,
    I am happy with both.
    #1 - I would be happy if the connection name was at the start of the tool-tip style pop-up when hovering over Query Results tab and the Query Result SQL dialog that opens on the SQL button. -K-'s suggestion makes it immediately obvious for the currently selected Query Results tab, without having to move the mouse or click on something.
    Ideally, I would like something similar for the other output tabs (ie Script Output), but they seem to show results for all connections that the worksheet has used, so the same concept may not work.
    #2 - I am used to the grid being cleared when disconnecting from earlier versions - I assumed that this was a bug where SQLD was not checking the connection of the results, just the current connection of the worksheet.
    theFurryOne

  • Transferring multi-column query result into MS Excel

    Hello everybody!
    An ultimate novice in Oracle, with some database concepts, is here.
    The very first challenge; which I encoutered is that I want to transfer a Select query result, with multiple columns, into MS Excel sheet in a way that each field occupies a separate column in the sheet.
    I hope the forum members will show me a simple way to get around the problem.
    Thanks in anticipation.
    Rabi

    what will happen the query returns too many rows that
    Excel cant hold? I faced this problem and divided the
    report into "n" numbers based on the number of rows
    returned. Is there any internal logic for it in
    oracle?Excel is capable of holding 65536 rows of data on a sheet.
    Oracle is capable of writing data out to files.
    Oracle does not know or care whether the file it is writing is for Excel or any other product, as the file you are likely to be writing is CSV (comma seperate format) which is an open format, not specifically for Excel. If you need to limit the number of rows per CSV file then you will have to code this "business logic" into your code that produces the CSV file from Oracle.

  • CohQL command line Tool select query output in file (unix)

    Ho to insert Coherence CohQL command line Tool select query result in file in unix platform. I have tried below query but failed
    query.cmd -s -c -l "select * from 'dist-example'" >myOutput.txt
    I also tried below query, result is displayed in command line but no file is created in folder.
    select * from dist-example >myOutput.txt
    I also tried one more query, result is displayed in command line but no file is created in folder.
    select * from dist-example >/opt/bin/myOutput.txt

    Hi,
    In Unix you should use query.sh instead of query.cmd
    In your case then the command would be smething like:
    query.sh -s -c -l "select * from 'dist-example'" >myOutput.txt
    You can also try using '>>' instead of '>' in order to redirect to a text file.
    Hope this helps.
    -Cris

  • Update only one select query field

    hello
    how i can update select query result field in original table.
    update table1 set field_1 from(select field_1 from table 1,table2,table3,table4 where table1.field_1=table1.field_1 and table2.field_2=table3.field_2 and table4.field_3=table1.field_4)
    like that.is it possible!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!can u please help me to rewrite query/
    select query returns result like that from different tables
    lets example field_1 field_2 field_3 field_4
    TIGER 1 V A
    TIGER 2 F B
    TIGER 3 R C
    I need to update 'TIGER' instead of 'LION' in original table.
    THANKS

    Maybe something like
    update table1
       set beast = (select animal
                      from <table_list>
                     where <predicates>
    where beast = 'LION'when your query returns a single row
    or when multiple rows are returned
    update (select t1.beast,t2.animal
              from (select beast,
                           <join_columns_list>
                      from table1
                     where beast = 'LION'
                   ) t1,
                   (select animal,
                           <join_columns_list>
                      from <table_list>
                     where <predicates>
                   ) t2
             where t1.<join_columns_list> = t2.<join_columns_list>
       set beast = animalRegards
    Etbin

  • How to pass query result to HTML table?

    Hi,
      i want to get the query result in HTMl table instead of Display Grid. how to do it? i searched in help, it suggests use icommand to do this. but i dont know how to pass the select query result to HTML table.. please help me.
    -senthil

    Hi Senthil,
    You can create an icommand query. You can then use the icommand retrieval methods to capture and manipulate the query data.
    (http://help.sap.com/saphelp_xmii115/helpdata/en/Applet_Reference_Details/iCom
    mand_Reference.htm)
    Basically what we did was, use the getColumnCount() and getRowCount() methods, once you have these two numbers you can set two for loops and use String getValue(int ColID, int RowID) , within the for loops you can generate the inner html content and write the values either in a html table or html form (which is what we did). This seems to work well, I'm still playing around with it and may post this approach on sdn by end of this week.
    Mahwish

Maybe you are looking for

  • Is it possible to use two context nodes in a single table view?

    Hi all, I have a window context node which is mapped to a dictionary structure. I have created a second node which contains some texts. I've mapped both nodes with the context  of a view. In this view I have created a table which shows lines of the f

  • Need to know maximum log size for advanced debugging option in Win 7

    We need to enable advanced debug logging for net logon service on all of our Windows 7 pcs to troubleshoot a major issue at our company.  I need to prove to management that when done so, the logs will never have runaway uncontrollable growth that com

  • Switching from mac to PC repeatedly??

    my ipod mini is currently formatted to a mac. however, i primarily use a PC and windows and there is a lot of music on my windows computer. i want to be able to use it on my PC and get the music from the computer, but i do not want to lose the music

  • Portal Session Timeout and Logon Ticket Timeout

    Hi All, Can anyone give me answers to the following: - If my Portal session times out, but my logon ticket is still valid, will I lose my session data? - Is there any way of determining the size of a users session information in memory (or the size o

  • Trying to get components inside a panel in content pane

    Hello, I am trying to update the combo boxes inside a panel with a list of values(list is stored as an array). My heirarchy of components is as follows: frame-->contentpane-->gamepanel-->combopanel-->combobox i am able pass my frame into my code. now