How to display the output as 'error' in this program

DECLARE

C_ID employees.sno%type: = 2;

employees.name%type c_name;

c_addr employees.country%type;

BEGIN

SELECT name, c_name, c_addr FROM Employees WHERE sno country is c_id;

DBMS_OUTPUT. Put_line (' name: ' | c_name);

DBMS_OUTPUT. Put_line (' address: ' | c_addr);

EXCEPTION WHEN no_data_found THEN

dbms_output.put_line ('no such customer!');

WHILE others

THEN dbms_output.put_line ('Error!');

END;

If I have 2 give her no customer display

and what I need to do to print error when you exit?

Because you manage the no_data_found error in your exception block there is no error for when others block to manage.  If you want to hit him when another fishing your code available, you can either remove the handler no_data_found, or introduce a different error condition, such as:

SQL > select * from employees;

SNO NAME NECK

---------- --------------- ---

1 John CAN

1 John CAN

SQL > DECLARE

2 c_id employees.sno%type: = 1;

3 employees.name%type c_name;

4 c_addr employees.country%type;

5 BEGIN

6. SELECT name, country IN c_name, c_addr

7 FROM employees

8. WHERE the sno = c_id;

9 DBMS_OUTPUT. Put_line (' name: ' | c_name);

10 DBMS_OUTPUT. Put_line (' address: ' | c_addr);

EXCEPTION 11

12. WHEN no_data_found THEN

13 dbms_output.put_line ('no such customer!');

14 SO that others THEN

15 dbms_output.put_line ('Error!');

16 END;

17.

Error!

PL/SQL procedure successfully completed.

The too_many_rows error introduced by the lines in the flow of the table to the when of other Manager.  Note the procedure message passed to PL/SQL.  Because the other handler handled the error, when more an error in the code block.  If it's a stored procedure, the appellant would never know that something had gone wrong, one of the reasons why when another Manager without a raise is a bad idea.

John

Tags: Database

Similar Questions

  • How to display the output of query clause?

    Hello. I use Forms Developer 10g. I have a datablock that uses a from_clause_query. In my from_clause_query, I used a WITH AS SELECT.
    I try to view the output of this query in my forms but the first column, V_CUTOFF_TO not displayed, probably because it is not a database element. It was a result of my initial query WITH AS SELECT month. How can I view this with the release of my from_clause_query. Thanks in advance for the help. Moreover, I am trying to post the contents of my from_clause_query here, but it says sorry, this content is not allowed. I don't know why?

    I was able to solve the problem by creating a stored procedure. I insert the records in a table in the procedure, and then I query the table. Thanks for your help.

  • How to cancel the menu "always open with this program" option

    Original title: open with problem

    Hello... I have a .uif file and my OS does not recognize the file. So open it with window popped up with a list of applications and I accidentally clicked on the notebook and I forgot to uncheck the always use this program to open this type of file option. I want to make it not recognized again. How can I do?

    I offer this tutorial

    http://www.SevenForums.com/tutorials/178296-file-extension-type-unassociate.html

  • How to display the output of PL/SQL and difficulty package below error (please help)

    -PACKAGE SPECIFICATION AND met with success, but I see no way out, an error is also here... Please help. How do I solve this problem
    -with the code

    CREATE OR REPLACE PACKAGE package_variables
    -Declare the components of a package.
    Established PROCEDURE (VARCHAR2 value);
    Public FUNCTION get RETURN VARCHAR2;
    END package_variables;
    /



    CREATE OR REPLACE PACKAGE BODY package_variables
    -Declare the package-scoped variable.
    variable VARCHAR2 (20): = "initial value";
    -Define the function
    Get function RETURN VARCHAR2 IS
    BEGIN
    RETURN variable;
    END get;
    -Define the procedure.
    PROCEDURE set(value VARCHAR2) IS
    BEGIN
    variable: = value;
    The END value;
    END package_variables;
    /



    Result VARIABLE VARCHAR2 (20)
    CALL package_variables.get () IN: result;
    SELECT: result AS result FROM dual;


    RUN package_variables.set ("new value '");
    CALL package_variables.get () IN: result;
    SELECT: result AS result FROM dual;

    /*

    OUTPUT


    PACKAGE compiled package_variables.
    PACKAGE compiled package_variables BODY.

    Error at startup on line 2 of the command:
    CALL package_variables.get () IN: results
    Error report:
    SQL error: ORA-01008: not all variables
    01008 00000 - "not all variables.
    * Cause:
    * Action:
    RESULTS
    --------------------------------


    1 selected lines

    anonymous block filled

    Error at startup on line 2 of the command:
    CALL package_variables.get () IN: results
    Error report:
    SQL error: ORA-01008: not all variables
    01008 00000 - "not all variables.
    * Cause:
    * Action:
    RESULTS
    --------------------------------


    1 selected lines

    */

    The package name is package_variables (note the 's'. Plural.) But using package_variable (in the singular) in your call.
    Also select in as a SQL statement seems to be not valid. You encapsulate a begin - end around her block.

    SQL> begin
      2  select package_variables.get into :outcome from dual;
      3  end;
      4  /
    
    PL/SQL procedure successfully completed
    outcome
    ---------
    Initial Value
    
  • 10.1.3.4 - BPEL how to display the output of Java Embedding

    I have a 2 steps java imbedding into my stream. base64ToString, replaceNamespace. I use the getVariableData and the setVariableData to access the data stream in this step and I'll put the values in a variable called xmlString. When running, I see only "run bpelx:exec" when I click on the java embedding step, I see quite the value of "xmlString. How can I see the value created breast this java embedding stage. System.out.println is not the answer I'm looking for.

    Use addAuditTrailEntry which will put your output as part of audit trail
    addAuditTrailEntry ("output:" + variableData)

    OR

    System.out.println

    It will be printed in the console.

  • How to display the horizontal output?

    Hi all

    I need to display the output horizontally in my report.

    Output current:

    col1 col2

    -----    ------

    1          a

    2          b

    3          c

    Power required:

    col1: 1 2 3

    col2: a, b and c

    I can do it by the layout of rdf, but I need to do it by XML editor or a publisher of BI, because I need excel output only.

    So any ideas?

    I can do it by the layout of rdf, but I need to do it by XML editor or a publisher of BI, because I need excel output only.

    you do this by rdf as report page or data model for the bi publisher model?

    so first case is rotate the data in rdf by sql and then put in model

    also the pivot in rtf http://docs.oracle.com/cd/E28280_01/bi.1111/e22254/create_rft_bldr.htm#BIPRD2681

    also the columns Dynamics http://docs.oracle.com/cd/E28280_01/bi.1111/e22254/create_rtf_tmpl.htm#BIPRD2546

  • How to display the list of components in ultiboard 10?

    The DRC report the errors where the components that are no longer in the design have been removed. How to display the list component and then remove them from the netlist to stop this?

    Ultiboard reported missing errors of component (part 'X' is not about design) because the part is always referenced by a net. To fix this, you must remove the part of the net. Following the steps below to remove the part form the net.

    1 tools > Netlist Editor

    2. for each network that the part has been connected to, select the Net (upper-left).

    3. Select the tab of pine trees, select the part and it is the PIN in the dialog box, then click on remove

    The problem is when the part is removed, I see no easy way to determine the threads you need to remove the part of. I entered this as a feature request to make this easier, but as a workaround, you can put part and say Ultiboard what the missing part, then search the net names on the pins and remove the part of these pins

    1 place a piece with a lot of pine trees (for example the part that was removed, or for example through Hole technology > Connectors > SIL & headers > HEADER2X9). When you place the part, make sure that the RefDes matches the RefDes of the part which has been removed.

    2. once the room is placed, you should see rats nest lines that connect the part to the nets.

    3 Zoom on the pins. You should now see the net name on each of the axes. For each of the pins connected, remove it from the net as described above.

    4. remove the part that you placed.

  • How to display the value of the variable for bottom of pl/sql

    How to display the value of the variable for bottom of pl/sql

    declare

    V_1 number: = 10;

    V_2 number: = 20;

    V_3 number: = 30;

    v_4 number: = 40;

    v_5 number: = 50;

    test varchar2 (100);

    Start

    I'm in 1.5

    loop

    test: = "v_" | I have;

    dbms_output.put_line(i||) e > ' | test);

    end loop;

    end;

    /

    How to get below output:

    1 > v_1

    2 > v_2

    3 > v_3

    4 > v_4

    5 > v_5

    But I want to output of

    1 > 10

    2 > 20

    3 > 30

    4 > 40

    5 > 50

    Hello

    You cannot reference variables as you did and get the value of the variable. Use pretty collection.

    set serveroutput on size 2000
    declare
      type      number_table is table of number;
      numbers   number_table := number_table(10, 20, 30, 40, 50);
    begin
      for i in numbers.first .. numbers.last
      loop
        dbms_output.put_line(i || '->' || numbers(i));
      end loop;
    end;
    /
    
    anonymous block completed
    1->10
    2->20
    3->30
    4->40
    5->50
    

    See the Collections of PL/SQL and Records http://docs.oracle.com/cd/E11882_01/appdev.112/e25519/composites.htm#LNPLS005

  • How to display the results in the order based on the value of research

    Hi all

    How to display the results in the slot order.
     
    
    CREATE TABLE TEST( SONGID  NUMBER, TITLE   VARCHAR2(200))
    
    INSERT INTO TEST(SONGID,TITLE) VALUES (10,'AHMADZAI, MIRWAIS (CA)/ MADONNA (CA)');
    INSERT INTO TEST(SONGID,TITLE) VALUES (11,'CICCONE, MADONNA (CA)');
    INSERT INTO TEST(SONGID,TITLE) VALUES (12,'DALLIN, MADONNA LOUISE/STOCK');
    INSERT INTO TEST(SONGID,TITLE) VALUES (13,'MADONNA');
    INSERT INTO TEST(SONGID,TITLE) VALUES (14,'MADONNA (A)/ AHMADZAI, MIRWAIS (C)');
    INSERT INTO TEST(SONGID,TITLE) VALUES (15,'MADONNA (CA)');
    INSERT INTO TEST(SONGID,TITLE) VALUES (16,'MIRWAIS AHMADZAI, MADONNA');     
    INSERT INTO TEST(SONGID,TITLE) VALUES (17,'MIRWAIS (CA)/ MADONNA (CA),AHMADZAI');
    INSERT INTO TEST(SONGID,TITLE) VALUES (18,'MADONNA (CA),CICCONE');
    
    SELECT *FROM  TEST WHERE INSTR (TITLE, 'MADONNA') > 0
    
    output: 
    SONGID     TITLE
    10     AHMADZAI, MIRWAIS (CA)/ MADONNA (CA)
    11     CICCONE, MADONNA (CA)
    12     DALLIN, MADONNA LOUISE/STOCK
    13     MADONNA
    14     MADONNA (A)/ AHMADZAI, MIRWAIS (C)
    15     MADONNA (CA)
    16     MIRWAIS AHMADZAI, MADONNA
    17     MIRWAIS (CA)/ MADONNA (CA),AHMADZAI
    18     MADONNA (CA),CICCONE
    
    Expected output :
    13     MADONNA
    14     MADONNA (A)/ AHMADZAI, MIRWAIS (C)
    15     MADONNA (CA)
    18     MADONNA (CA),CICCONE
    ..
    ..
    ..
    ..
    ...
    If the user makes a search with "MADONNA", I view the results as title begins with "MADONNA" first then the rest of the records.
    Please let me know is possible to show the results in this order.


    Kind regards
    Rajasekhar

    This can be a little more specific:

    SQL> SELECT *
      2  FROM   TEST
      3  WHERE  INSTR (TITLE, 'MADONNA') > 0
      4  ORDER  BY INSTR (TITLE, 'MADONNA')
      5           ,TITLE
      6  ;
    
                  SONGID TITLE
    -------------------- --------------------------------------
                      13 MADONNA
                      14 MADONNA (A)/ AHMADZAI, MIRWAIS (C)
                      15 MADONNA (CA)
                      18 MADONNA (CA),CICCONE
                      12 DALLIN, MADONNA LOUISE/STOCK
                      11 CICCONE, MADONNA (CA)
                      17 MIRWAIS (CA)/ MADONNA (CA),AHMADZAI
                      16 MIRWAIS AHMADZAI, MADONNA
                      10 AHMADZAI, MIRWAIS (CA)/ MADONNA (CA)
    
  • How to display the rownum in oracle forms?

    Hai all,

    How to display the rownum in oracle forms?

    Thank you
    RCS
    ----------------

    I would add rowum with the current form of group_mstr:

    former columns:

    group_id
    GroupName

    new columns will be:

    identifier of the line
    group_id
    GroupName


    I created as follows:
    in forms
    text tool > row id
    text element > EXT_ITEM20

    error text element: no white color, it's a different color
    --------------

    create > Trigger > a time new form instance > I gave like this:

    DECLARE
    CURSOR crrow_id IS
    SELECT count (*) + 1 group_mstr;
    BEGIN
    OPEN crrow_id.
    Search FOR crrow_id IN: TEXT_ITEM20;
    CLOSE Crrow_id;
    END;
    ------------
    error: identifier group_mst must be declard
    ============

    I don't know also not quite what you want to display in your form. Do you want to just number the records displayed, from 1 to n?

    If so, create a text whose property 'data base element' element to the value 'no', "calculation method" formula and the formula itself: SYSTEM. " TRIGGER_RECORD, then, in each case, the registration number should be indicated.

  • How to display the width of the page or the big screen in firefox 11 automatically?

    How to display the width of the page or the big screen in firefox 11 automatically? I know how to Ctrl +, ctrl - and ctrl 0, but is there a way to define 11 firefox to automatically set the page viewing by default "page width" or full screen (F11 not)?
    Help, please. Thank you.

    You can use an extension to set a page zoom and the size of the default font on the web pages.

  • How to display the drop-down list box in MS excel by using labview report generation toolkit? pleasepost code block diagram?

    How to display the drop-down list box in MS excel by using labview report generation toolkit? Please post the block diagram of the code so that I can able to generate from the drop-down list box in excel with the menu drop-down...

    Like this. (edition, use the reference forms instead of the reference to the worksheet)

    Ben64

  • How to display the name of my refnum on the front?

    I write data to a file. To do this, I use ' Open/create/replace the file' to prompt the user for a file name, which is then out of my VI as a refnum. I then write strings in this file with "write to a text file.

    How to display the name of the file (including the path) on the front panel once the user has entered it?

    Michael

    Use the Refnum at the path of e/s from file-> advanced file palette. You can wire it to a path indicator.

  • How to display the wireless in my xp on lenovo 3000n200 please show me shortened steps you

    How to display the wireless in my xp on lenovo 3000n200 please show me shortened steps you

    Hello

    1. do you have problems connecting to the wireless network?
    2. don't you make changes to your computer, after which the issue started?
    3. where exactly you want to display the wireless network?

    If you have problems to connect to the network, I would recommend that you reinstall the wireless network cards.

    Follow the steps in this article.

    http://support.Microsoft.com/kb/283658

  • How to display the lsit of play while visualizations are playing

    How to display the playlist while visualizations are playing

    What version of WMP are you using?

    You can usually right click the button reading at the top and select view the list pane.

Maybe you are looking for

  • Firefox does not

    I have recently upgraded to Windows 10 and now can no longer use Firefox. I tried a new install and it did not resolve it. Pages appear as broken images, or the shells of Web pages. I am also unable to access the Mozilla site properly... by clicking

  • P30-145 satellite - computer cooling system becomes too hot

    Hello Can someone tell me the speed of maximum ventilation for Satellite P30-145, Im of the problems with the cooling system, because my computer is because cutting as its not too hot, Ive currently had raised by 1 inch on wooden beams to help the ci

  • Can I install programs on external hard drive?

    Original title: external hard drive I need to free up space and my hard drive. Can I take MS Works off the hard drive, put it on an external drive and use it or is it related to Windows XP and prevent this use? Same question for McAfee, Adobe and oth

  • Pavillion dv7 tx 2014: card reader does not

    In Device Manager, it is in portable devices and driver is UMDF/WpdFs.dll but can not use the card reader to all the HP SP45046 driver has been installed I can't update driver at all.

  • Patch authentication LEAP Cisco space required for Windows 7 64 bit Home Edition

    Hi all: I tried both Vista Business 32-bit PC and Windows 7 Home edition 64 bit for Cisco LEAP Authentication. The result is that Vista Bz PC can have authentication option Cisco LEAP under wireless security option, Windows 7 Home Edition 64 bit does