How to view the result of any SQL script

Hi
I am working on Oracle 10 g Express Edition.I have an explicit cursor code ,a very basic one.I want to know how can i view result of the script.When i Save and run the script i get nothign on the window.
I am pasting the script for the Reference.
Code
Declare
CURSOR c_p IS
select p_id from PRODUCTS;
v_pid PRODUCTS.p_id%type;
Begin
OPEN c_p;
Loop
FETCH c_p into v_pid;
Exit when c_p%NOTFOUND;
Dbms_output.put_line(v_pid);
End loop;
CLOSE c_p;
End;
Prod_id Prod_category Prod_name Prod_price
123456 Games Sony PS3 599.99
234567 Games Sony PSP 249.99
345678 Games Nintendo Wii 249.99
456789 Games Microsoft Xbox 360 349.99
567890 Computer Microsoft Vista 349.99

Hi,
Try like this:
SQL> set serveroutput on
SQL> DECLARE
  2  CURSOR c_p IS
  3  select first_name from EMP;
  4  v_name EMP.first_name%type;
  5  Begin
  6  OPEN c_p;
  7  Loop
  8  FETCH c_p into v_name;
  9  Exit when c_p%NOTFOUND;
10  Dbms_output.put_line(v_name);
11  End loop;
12  CLOSE c_p;
13  End;
14
15
16  /
Steven
Neena
Lex
Alexander
Bruce
David
Valli
Diana
Nancy
Daniel
John
Ismael
Jose Manuel
Luis
Den
Alexander
Shelli
Sigal
Guy
Karen
Matthew
Adam
Payam
Shanta
Kevin
Julia
Irene
James
Steven
Laura
Mozhe
James
TJ
Jason
Michael
Ki
Hazel
Renske
Stephen
John
Joshua
Trenna
Curtis
Randall
Peter
John
Karen
Alberto
Gerald
Eleni
Peter
David
Peter
Christopher
Nanette
Oliver
Janette
Patrick
Allan
Lindsey
Louise
Sarath
Clara
Danielle
Mattea
David
Sundar
Amit
Lisa
Harrison
Tayler
William
Elizabeth
Sundita
Ellen
Alyssa
Jonathon
Jack
Kimberely
Charles
Winston
Jean
Martha
Girard
Nandita
Alexis
Julia
Anthony
Kelly
Jennifer
Timothy
Randall
Sarah
Britney
Samuel
Vance
Alana
Kevin
Donald
Douglas
Jennifer
Michael
Pat
Susan
Hermann
Shelley
William
PL/SQL procedure successfully completed.
SQL>Cheers,

Similar Messages

  • How to export the result from executing sql statement to excel file ?

    HI all,
    Great with Oracle SQL Developer, but I have have a trouble as follwing :
    I want to export the result from executing sql statement to excel file . I do easily like that in TOAD ,
    anyone can help me to do that ? Thanks so much
    Sigmasvn

    Hello Sue,
    I just tried to export to excel with the esdev extension and got java.lang.NumberFormatException. I found the workaround at Re: Windows Multi-language env, - how do I set English for application lang?
    open the file sqldeveloper\jdev\bin\sqldeveloper.conf and add the following two lines:
    AddVMOption -Duser.language=en
    AddVMOption -Duser.country=USyet now my date formats in excel are 'american-style' instead of german. For example 01-DEC-01 so excel does not recognize it as date and therefore I can not simply change the format.
    When export to excel will be native to 1.1 perhaps someone can have a look at this 'feature'
    Regards
    Marcus

  • How to use the result of a sql query for a max () function

    Hi
    I wrote a query on which i wrote
    "select max(id) from users "
    how can i use the returned value.
    if i made the var name ="userid"
    can it be userid.rows[0] or what.
    thnx for any help

    Hi!
    The result of this query will be the max ID of users' IDs.
    Let say we have:
    String sql="select max(users.id) from users";
    Statement st = ctx.conn.createStatement();
    ResultSet rs = st.executeQuery(sql);
    rs.next();     
    So you can get the max Id in the following way:     
    int maxId=rs.getInt("id");
    Regards,
    Rossi

  • How to use the result of simple shell script?

    The shell script below retrieves the length of an audio file:
    set aFile to choose file
    do shell script "afinfo " & quoted form of (POSIX path of aFile) & "|grep duration"
    I'm wondering, how can I copy the result to the clipboard or set the value of a variable to it?
    Total newbie question. I have no idea about shell scripts - I just found the script above online.
    Thank you so much!

    Here:
    set the clipboard to (do shell script "afinfo " & quoted form of (POSIX path of aFile) & "|grep duration")
    or:
    set A to do shell script "afinfo " & quoted form of (POSIX path of aFile) & "|grep duration"
    (53997)

  • How to view the results of progress analysis

    Dear Experts,
    I executed progress analysis for my project analysis in CNE1 for my project.
    After execution, PA has been completed for two WBS elements. But iam not able to see any POC values or costs.
    Where should I check and confirm that Progress analysis has been carried out successfully.
    Pls suggest.

    Hi,
    Run the transactio CNE5 for the project progress analysis ,you will get the following reports.
    The standard reports offer various values we can use to assess the progress of our project. The following fields are defined in the standard progress analysis reports:
    - Planned POC in percent
    - Actual POC in percent
    - Budget Cost of Work Schedule, BCWS
    - Budget Cost of Work Performed, BCWP
    - Cost variance (CV)
    - Schedule variance (SV)
    - Value index (CPI)
    - Estimated costs at completion (EAC)
    Regards,
    Raj

  • Pass the result of a SQL Query as table_name  for another SQL Query

    Hi All,
    How to pass the result of a SQL Query as parameter to another SQL Query
    Eg: I am doing the steps below.
    1) select distinct table_name as TAB1 from all_tab_cols where table_name like 'T_%' and column_name like '%XYZ'
    2) I want to pass the table_name from step 1 above as parameter to another query "select * from TAB1"
    Thanks

    Naveen B wrote:
    Hi All,
    How to pass the result of a SQL Query as parameter to another SQL Query
    Eg: I am doing the steps below.
    1) select distinct table_name as TAB1 from all_tab_cols where table_name like 'T_%' and column_name like '%XYZ'
    2) I want to pass the table_name from step 1 above as parameter to another query "select * from TAB1"
    ThanksYou should craete PL/SQL code with cursor which will accept a parameter and call that cursor inside the first one
    But if the first sql returns only one row, you can do it with simple sql code
    select * from (select distinct table_name as TAB1 from all_tab_cols where table_name like 'T_%' and column_name like '%XYZ')- - - - - - - - - - - - - - - - - - - - -
    Kamran Agayev A. (10g OCP)
    http://kamranagayev.wordpress.com
    [Step by Step install Oracle on Linux and Automate the installation using Shell Script |http://kamranagayev.wordpress.com/2009/05/01/step-by-step-installing-oracle-database-10g-release-2-on-linux-centos-and-automate-the-installation-using-linux-shell-script/]

  • How to view the sql query?

    hi,
      how to view the sql query formed from the xml structure in the receiver jdbc?

    You can view SAP Note at
    http://service.sap.com/notes
    But you require SMP login ID for this which you should get from your company. The content of the notes are as follows:
    Reason and Prerequisites
    You are looking for additional parameter settings. There are two possible reasons why a feature is available via the "additional parameters" table in the "advanced mode" section of the configuration, but not as documented parameter in the configuration UI itself:
    Category 1: The parameter has been introduced for a patch or a SP upgrade where no UI upgrade and/or documentation upgrade was possible. In this case, the parameter will be moved to the UI and the documentation as soon as possible. The parameter in the "additional parameters" table will be deprecated after this move, but still be working. The parameter belongs to the supported adapter functionality and can be used in all, also productive, scenarios.
    Category 2. The parameter has been introduced for testing purposes, proof-of-concept scenarios, as workaround or as pre-released functionality. In this case, the parameter may or may not be moved to the UI and documentation, and the functionality may be changed, replaced or removed. For this parameter category there is no guaranteed support and usage in productive scenarios is not supported.
    When you want to use a parameter documented here, please be aware to which category it belongs!
    Solution
    The following list shows all available parameters of category 1 or 2. Please note:
    Parameter names are always case-sensitive! Parameter values may be case-sensitive, this is documented for each parameter.
    Parameter names and values as documented below must be used always without quotaton marks ("), if not explicitly stated otherwise.
    The default value of a parameter is always chosen that it does not change the standard functionality
    JDBC Receiver Adapter Parameters
    1. Parameter name: "logSQLStatement"
                  Parameter type: boolean
                  Parameter value: true for any string value, false only for empty string
                  Parameter value default: false (empty String)
                  Available with: SP9
                  Category: 2
                  Description:
                  When implementing a scenario with the JDBC receiver adapter, it may be helpful to see which SQL statement is generated by the JDBC adapter from the XI message content for error analysis. Before SP9, this can only be found in the trace of the JDBC adapter if trace level DEBUG is activated. With SP9, the generated SQL statement will be shown in the details page (audit protocol) of the message monitor for each message directly.
                  This should be used only during the test phase and not in productive scenarios.
    Regards,
    Prateek

  • How to view the entire CLOB in results table?

    According to the release notes with 1.2.1.32, a recent bug fix changed the way CLOBs are displayed in SQL Developer:
    Bug 6254736: Clob datatype in table grid fetches the whole clob
    Before the fix, for any given CLOB field, the entire CLOB data would be displayed. After the fix, only "(CLOB)" and a few characters are displayed. The entire data is only accessible via the Edit Value dialog.
    I understand this change will likely improve performance for very large CLOBs. However, there are times when I want to be able to view the entire CLOB in the table grid (either in the data tab or as the result of a SQL query). Is there any way to restore the old functionality? If not, is there any plan to add a new preference to support the old functionality? Thanks for your help!

    The same issue was pointed a while back here : Re: RAW displayed in columns
    We would have a solution for it, most likely as a preference.
    -Raghu

  • I'm wondering if there is any way to view the results of the form other than in a spreadsheet?  Is it possible to print responses one by one in PDF format, or word, etc?  I'd like to create a form for proposal applications, and the spreadsheet format resu

    I'm wondering if there is any way to view the results of the form other than in a table?  Is it possible to print responses one by one in PDF format, or word, etc?  I'd like to create a form for proposal applications, and the spreadsheet format results are nearly unusable for this type of form.

    Hi Nalani500 ,
    Yes, you can print the response in a PDF by following the steps suggested below.
    1) Go to the response file
    2) Select the response you want to print
    3) Click on Save as PDF button and it would save the selected response in PDF format.
    Thanks,
    Vikrantt Singh

  • MS SQL server is going down frequently(10 days of gap) with exception message: "A severe error occurred on the current command. The results, if any, should be discarded".

    MS SQL server is going down frequently(10 days of gap) with exception message: "A severe error occurred
    on the current command. The results, if any, should be discarded". We are facing this issue for past two month.But funny thing is server will be up automatically with out any service restart manually.  Also if we try to restart the SQL
    server service manually then SQL server will be in a dead lock situation and it will not come up even if we wait for long time. Then we should do a windows server machine restart to
    make the SQL sever up. As a suggestion from Microsoft to fix this kind of similar issue,
    we have installed service pack 3 for SQL Server. But even after we are facing same issue.
    Server Details:
    Server OS: Windows Server 2008 R2
    Two type of database servers are installed on server:
    1. MS SQL Server 2008 R2
    2. My SQL
    Also Reporting server is configured for the purpose of generating SSRS report from a dot net website.
     NOTE:Immediately after the data retrieval/save, we are closing the connection explicitly by the
    application.
    we have checked the windows event log and below are the details:
    Log Name:      Application
    Source:        ASP.NET 4.0.30319.0
    Application information:
        Application domain: /LM/W3SVC/5/ROOT-1-130718142067856406
        Trust level: Full
        Application Virtual Path: /
        Application Path: E:\WebSpaceFolder\ACSQuiK\Production\
        Machine name: DBSERVER 
     Process information:
        Process ID: 148
        Process name: w3wp.exe
        Account name: NT AUTHORITY\NETWORK SERVICE 
     Exception information:
        Exception type: SqlException
        Exception message: A severe error occurred on the current command.  The results, if any, should be discarded.
       at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
       at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
       at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
    Log Name:      Application
    Source:        Report Server Windows Service (MSSQLSERVER)
    Description:
    Report Server Windows Service (MSSQLSERVER) cannot connect to the report server database.
    Event Xml:
    <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
      <System>
        <Provider Name="Report Server Windows Service (MSSQLSERVER)" />
        <EventID Qualifiers="0">107</EventID>
    Could anybody can suggest any kind of fix for this issue? Thanks in advance.

    Hi YesYemPee,
    I have tried but still not clear about your issue, I would like you provide more details information about your issue based on below points to better analysis about the issue:
    What action did you do and caused the error "A severe error occurred on the current command. The results, if any, should be discarded", did you run report on the web application or something else then the error happen?
    If you rendering the report and got the error, please try to provide us more error information in the log files which path like:
    C:\Program Files\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Reporting Services\LogFiles
    If it is not the case in step1, Please try to provide SQL Server Error log(SQL Server Logs) and more details information.
    If you still have any problem, please feel free to ask.
    Regards,
    Vicky Liu
    Vicky Liu
    TechNet Community Support

  • How to export the result to excel or txt as the SQL result format.

    Hello,
    I want to know how to export the result of the Oracle select result to a txt or a excel file.What is the command.
    I knew the command of spool,but the format of it export is not the same to the result of Oracle result area.
    Thank you very much.

    Hello Yucky,
    what do you mean by
    the format of it export is not the same to the result of Oracle result areaDo you mean the output of a tool other than SQL*PLUS?
    To enhance the formatting of a spool file you can set
    SET MARKUP HTML ON
    SPOOL ONthis will add html markup to format the output as a html table which you can open in a browser or in excel.
    Regards
    Marcus

  • A server error occurred on the current command. the results if any should be discarded in SQL 2008 R2

    Hi,
    I am using SQL server 2008 R2 and also MultipleActiveResultSet = true and Pooling = true (default value) in connection string.
    While executing query 'IF ORIGINAL_LOGIN() = SUSER_SNAME() EXECUTE AS USER = 'MyUser'', I received error stating  'A server error occurred on the current command. the results if any should be discarded'. At the same time I could check that SqlConnection
    state is also closed.
    I have also fired 'REVERT' query If I find such exception and again try to execute same query again. but no luck. I received the same exception while executing query (Execute As) again.
    What can be the solution to avoid such exception and make my code working?
    Thanks,
    Ashish

    Login failed for user 'sa'. The user is not associated with a trusted SQL Server connection.
    Above issue occurs genrally when authentication mode is set to Windows Authentication insted Mixed Mode.
    You can change the authentication mode of the SQL server from “Windows Authentication Mode (Windows Authentication)” to “Mixed Mode (Windows Authentication and SQL Server Authentication)”.
    Run following script in SQL Analyzer to change the authentication
    LOGIN sa ENABLE
    GO
    ALTER LOGIN sa WITH PASSWORD = '<password>'
    GO
    http://blog.sqlauthority.com/2007/04/14/sql-server-fix-error-18452-login-failed-for-user-null-the-user-is-not-associated-with-a-trusted-sql-server-connection/
    But as per the first post it seems issue is different have you observerd Error log?
    Check out at C:\Program Files\Microsoft SQL Server\MSSQL.n\MSSQL\LOG\ERRORLOG
    Location might differ as per the Server configration
    Please click the Mark as answer button and vote as helpful if this reply solves your problem

  • How to view the login log in window NPS after login cisco switch and without SQL server database

    how to view the login log in window NPS after login cisco switch and without SQL server database
    in summary 
    there is only log with event id 4400
    A LDAP connection with domain controller XCPAWS20.cyberport.noc for domain NOC2 is established.

    Hi adil,
    For your issue, you can create a custom security token service (STS) and then set up a trust relationship between a SharePoint 2010 farm and the custom STS.
    For more information, you can refer to the articles:
    http://forums.asp.net/t/1335229.aspx?Sharing+Authentication+Ticket+Between+ASP+NET+and+Sharepoint
    https://msdn.microsoft.com/en-us/library/office/ff955607(v=office.14).aspx
    http://www.paraesthesia.com/archive/2011/02/01/working-with-windows-identity-foundation-in-asp-net-mvc.aspx/
    Best Regards,
    Eric
    Eric Tao
    TechNet Community Support

  • I wanted to know how to view the gifts I've sent to people and (if possible) know if they received and downloaded them. Is there any way to do that, other than asking the person?

    I wanted to know how to view the gifts I've sent to people and (if possible) know if they received and downloaded them. Is there any way to do that, other than asking the person? Obviously I want the gift to be a surprise (for my best friend specifically) so asking them if they received it would ruin that.

    Have you tried resetting your iPod:
    Press and hold the On/Off Sleep/Wake button and the Home
    button at the same time for at least ten seconds, until the Apple logo appears.

  • When I get messages from Barnes and Noble, the text is blank. If I hit reply or forward, I can then see the content. This only happens with Barnes and Noble. Any suggestions on how to view the content?

    When I get messages from Barnes and Noble, the text is blank. If I hit reply or forward, I can then see the content. This only happens with Barnes and Noble. Any suggestions on how to view the content?

    I'm sorry, but your sister, unless she had already turned on the "Find my iPhone" feature and the person who took the phone has not disabled it, is out of luck. She should report the theft to local police authorities, including the serial number of her iPhone. While her experience is unfortunate, there are good reasons why Apple cannot do anything else about it.
    I hope she gets her phone back.
    Best of luck.

Maybe you are looking for

  • How do I remove a device from my apple account

    restored my ipad and now it is asking for my apple id and password that was used when I first got the device.  I have been entering my current apple and password, but it is not accepting, but stated that I could remove the device my my apple account.

  • TS3899 I can't see messages all of a sudden in my inbox when I connect via gmail but ok from message icon in my ipad

    Hi I have a problem. I was happily deleting and moving some emails from my Inbox on my ipad when all of a sudden, the messages just disappeared!!! When I tried to get to that page again, the address reads"mail.google.com/mail/mu/mp/12#tl/Inbox. So fr

  • Ora-02062_and_pending_transactions

    I've got oracle enterprise edition 10.2.04 In alert log I found ORA-02062: distributed recovery received DBID ... I found transaction in DBA_2PC_PENDING and similar in DBA_2PC_NEIGHBORS; select local_tran_id,state from dba_2pc_pending;LOCAL_TRAN_ID S

  • Simulations in FPGA

    Hi all, I started learning LabVIEW FPGA very recently and I have a query regarding the simulations that can be done. I don't have any NI FPGA hardware with me. I am using only the development computer for programming in LabVIEW FPGA.  I am using "Exe

  • Can a user override the Current Date field?

    I have a simple form with a Current Date field.  Today's date is automatically populated in this field, but I would like to give users the option to enter a different date in the field.  There is a value called "Calculated - User Can Override" but th