that is wrong with this code

My goal is to retrieve a record based on the empid
create or replace procedure proc1(p_empid number)
is
employee_rec employees%rowtype
cursor c is
select * from employees into employee_rec where employee_id=p_empid;
begin
for a in c
loop
dbms_output.put_line(a.employee_rec)
end loop;
end;
thnx in advance for your answers

>
is not to show the exact error, but suffice it to say that there are compilation errors
>
It works for me

create or replace procedure proc1(p_empid number)
is
employee_rec employees%rowtype;
cursor c is select * from employees where employee_id=p_empid;
begin
open c;
loop
fetch c into employee_rec;
exit when c%notfound;
dbms_output.put_line(employee_rec.employee_id);
end loop;
close c;
end;
/

exec proc1(200);

200

This also works:

create or replace procedure proc2(p_empid IN number)
is
cursor c is
select *  from employees where employee_id=p_empid;
begin
for a in c
loop
dbms_output.put_line(a.last_name);
end loop;
end;

exec proc2(200);

Whalen

Tags: Database

Similar Questions

  • What's wrong with this code? :)

    Hi guys - would appreciate some help here, I think I'm close, but...

    I'm writing javascript to check if several fields are null. Basically if ONE of the fields are filled, then FinanceNotes should = 'filled', if they are null then it should be 'empty '.

    The code I have so far is lower however I'm not sure that the correct syntax is to add all the fields (FinanceImpact7, HealthSafetyImpact7 etc.) - is & & or | etc?

    If (ImpactsTable.Row1.FinanceImpact7.rawValue == null & & ImpactsTable.Row2.HealthSafetyImpact7.rawValue == null & & ImpactsTable.Row2.OpsBusinessImpact7.rawValue == null)

    {

    Subform2.ImpactsTable.Row1.FinanceNotes.RawValue = "empty";

    }

    on the other

    {

    Subform2.ImpactsTable.Row1.FinanceNotes.RawValue = "full";

    }



    Bravo!

    Ellis

    You use expressions SOM wrong, because you're pointing to row2, which does not contain the desired field.

    Subform2.ImpactsTable.Row1.FinanceNotes.rawValue = ImpactsTable.Row1.FinanceImpact7.isNull && ImpactsTable.Row2.HealthSafetyImpact7.isNull && ImpactsTable.Row2.OpsBusinessImpact7.isNull && ImpactsTable.Row2.OpsCustomersImpact7.isNull && ImpactsTable.Row2.OpsEmployeesImpact7.isNull && ImpactsTable.Row2.ReputationHeader7.isNull && ImpactsTable.Row2.ReputationStakeholders7.isNull ? "empty" : "filled";
    

    Change in:

    ImpactsTable.Row1.FinanceNotes.rawValue = ImpactsTable.Row1.FinanceImpact7.isNull && ImpactsTable.Row2.HealthSafetyImpact7.isNull && ImpactsTable.Row3.OpsBusinessImpact7.isNull && ImpactsTable.Row4.OpsCustomersImpact7.isNull && ImpactsTable.Row5.OpsEmployeesImpact7.isNull && ImpactsTable.Row6.ReputationHeader7.isNull && ImpactsTable.Row7.ReputationStakeholders7.isNull ? "empty" : "filled";
    
  • What's wrong with this code? Race condition?

    Guys,

    The idea behind the enclosed code is fairly simple.

    I have a 2D parent table. First of all, I print a subset of this table in an array of control (based on a selection of sensor). Now, I want to change the numbers in the table. I need changes are reflected in the table and the table parent 2D. (In simple terms, it's like replacing the subset of the table published in the parent 2D table)

    The problem is when I change any entry in the table, the entry passes to its original value. The change does not appear to be reflective on the 2D of parent table and the table. .

    Can someone tell me where is the problem?

    Thank you

    Ravi

    Thanks for the advice of Chris and ton,

    Now the code looks neat and fact exaclty what I wanted.

    See you soon

  • Can someone tell me what's wrong with this code?

    I try to display an 'X' icon beside the offending error. If I take the test 'if' code runs. If I leave it in the symbol does not work.

    Thank you

    David

    var emailFromVal = Email.value;

    var messageVal = ' < strong > < p > < police = "helvetica" size = "5" > name: "+ Firstname.value +" < br > < br > Last Name: "+ Lastname.value +" < br > < br > Message: ' + Message.value + '< /p > ";

    We add this variable to check if someone find the address of our php file cannot send empty message by calling a php URL file

    var Permission = 1;

    If ((Firstname.value == "") {})

    move the cursor to the error to fix x, y and see the error occurred

    SYM. $("Croix") .css ("left", 10);

    SYM. $("Croix") .css ('top', 90);

    SYM.$("cross"). Show();

    }

    else {}

    Alert ("thank you, we will contact you shortly");

    .post $("sendEmail.php", {drapeau: Permission, Courriel: emailFromVal, messages: messageVal});

    }

    SYM.$("#email"). Detach();

    SYM.$("#FirstName"). Detach();

    SYM.$("#LastName"). Detach();

    SYM.$("#message"). Detach();

    Permission = 0;

    SYM. Play ("smell");

    There are two braces in the stated case

    "If ((" remove one of them.

  • that is wrong with this loop

    1 Declare
    2 v_system_user VARCHAR2 (30);
    3 v_system_user_flag number: = 0;
    4 v_username varchar2 (30);
    5 cursor C_system_users is select * from dbaoper.t_system_users;
    6 start
    7 for v_system_user in C_system_users loop
    8 dbms_output.put_line('v_system_user');
    9 if v_username = v_system_user
    10. can
    11 v_system_user_flag: = 1;
    12 end if;
    13 end of loop;
    14 * end;
    SQL > /.
    If v_username = v_system_user
    *
    ERROR on line 9:
    ORA-06550: line 9, column 16:
    PLS-00306: wrong number or types of arguments in the call to '='
    ORA-06550: line 9, column 2:
    PL/SQL: Statement ignored


    Thank you
    Pramod

    You declare a variable of v_system_user second here:

    Pramod Garre wrote:
    7 for v_system_user in C_system_users loop

    Probably, you would do this:

    for r in C_system_users loop
    ...
    if r. = ....
    ...
    

    Published by: Toon Koppelaars July 8, 2009 17:20

  • Pls whats wrong with this code?

     
    create or replace trigger o_time_trig
     after update on o_time
     for each row
     begin
     update o_time
     set hours_overtime =>35
     where emp_id = :NEW.emp_id;
     end;
     /
    Warning: Trigger created with compilation errors.
    
    SQL> show errors;
    Errors for TRIGGER O_TIME_TRIG:
    
    LINE/COL ERROR
    -------- -----------------------------------------------------------------
    2/1      PL/SQL: SQL Statement ignored
    3/20     PL/SQL: ORA-00927: missing equal sign
    It gives me an error.

    I just want to write a trigger...

    create or replace trigger o_time_trig
    before update on o_time
    for each row
    begin
      :new.hours_overtime = :new.hours_worked - 35;
    end;
    
  • Which is wrong with this code? 1180 error.

    I get error 1180:Call to undefined method getURL possible

    var jscommand:String = "window.open ('www.adobe.com', 'victory ',' height = 1024, width is 768, toolbar = no, scrollbars = yes')"; getURL ("javascript:" + jscommand + "void (0);");

    Any help would be appreciated.

    Thank you guys.

    getURL is AS2, AS3 code no.

  • that is wrong with this implicit cursor

    Hi all

    I use oracle 9i db and form 6i

    I wrote cursor tis to convert a data type of column into another column precreee

    Start
    for imp_cur (select id, id_no from stud) loop
    setting a day of stud set id_no = to_number (id);
    end loop;
    Commit;
    end;

    Tip: id is varchar2

    Thank you very much...

    Hai,

    Try this

    DECLARE
         Str_ID VARCHAR2(100);
         CURSOR Cur_ID IS SELECT ID FROM STUD;
    BEGIN
         OPEN Cur_ID;
         LOOP
              FETCH Cur_ID INTO Str_ID;
              EXIT WHEN Cur_ID%NOTFOUND;
              UPDATE STUD SET ID_NO = TO_NUMBER(Str_ID) WHERE ID = Str_ID;
         END LOOP;
         COMMIT;
    END;
    

    Kind regards

    Manu.

    If this answer is useful or appropriate, please mark. Thank you.

  • Had to reformat my hard drive, now when I try to reinstall Windows XP I get a blue screen with this code at the end 0x0000007b.

    has had to reformat my hard drive now when he star0x0000007b (0x78d663c, 0xc0000034, 0x00000000, 0x00000000)

    has had to reformat my hard drive, now when I try to reinstall windows xp, I get a blue screen with this code at the end 0x0000007b (0x78d663c, 0xc0000034, 0x00000000, 0x00000000) how to solve this problem

    Hello

    I saw the 0x0000007B BSOD caused by trying to install XP on a disk hard while the BIOS is designating the reader as AHCI instead of IDE. XP has no native AHCI drivers, resulting in a stop 7B. Unless the PC had originally Vista or Win 7, but it might be useful to check that it is not likely.

    If the BIOS is set to AHCI, you could do one of three things (depending on whether your PC has a floppy drive)...

    1 find the Setup F6 disk on AHCI support at installation time (start with the manufacturer's website if you do not already have such a thing). Watch the very hit F6 prompt early in the installation process.

    2. change the setting in BIOS on IDE / ATA

    3. create a new "slipstreaming" installation disc drivers AHCI in the existing installation disc, see http://www.nliteos.com/index.html

    After the back if your BIOS is IDE / ATA

    Tricky

  • Rounded corners code - what is wrong with my code?

    Hello

    I'm trying to use Win DW5 and CSS3 for rounded corners of the boxes (only at the top left and top right rounded - down should be square) in pure CSS3.

    Can someone tell me what is wrong with my code below?  (Top of page code makes 4 corners roudned and background code doesn't appear to upper right corner rounded - and not the left one.

    < div style = "padding: 10px;" Width: 445px; height: 370px; border-radius: 10px; -o-border-radius: 10px; -icab-border-radius: 10px; -khtml-border-radius: 10px; -moz-border-radius: 10px; -webkit-border-radius: 10px; background-color: #d1ddf7; border: 1px solid #000; ">

    < / div >

    < p > < / p >

    "< div style =" width: 445px; height: 370px;

    border-radius:

    -webkit-border-top-left-radius: 10px;

    -webkit-border-top-right-radius: 10px;

    -moz-border-radius-topleft: 10px;

    -moz-border-radius-topright: 10px;

    background-color: #d1ddf7; border: 1px solid #000; ">

    < / div >

    "Thx. for any help.

    Jane

    Take a look at this:

    http://www.CSS3.info/preview/rounded-border/

    Nancy O.
    ALT-Web Design & Publishing
    Web | Graphics | Print | Media specialists
    http://ALT-Web.com/
    http://Twitter.com/ALTWEB
    http://ALT-Web-design.blogspot.com/

  • ORA-31011: analysis XML has not, someone can like me wats wrong in this code

    Hi all

    I am trying to parse an XML document, for which I wrote a code on the XML parsing.

    I'm moving to an XML document, which will be in a format, I can't change that.

    Now, I have to get values to individual items such as FROM_USERID and TO_USERID, and MESSAGE.

    Here is the code

    create or replace procedure myparsing is
    new_msg_str varchar2 (4000);
    XMLType new_msg_xml;
    v_from_user varchar2 (8);
    v_to_user varchar2 (8);
    v_msg_tmp varchar2 (4000);
    v_msg varchar2 (4000);
    payloadxml varchar2 (2000);
    Chat.objmessage_typ MyMsg;
    n number;

    getvalueat function)
    NodeList dbms_xmlDom.DOMNodeList, xPath varchar2)
    VARCHAR2 is back
    Start
    Return to dbms_xslprocessor.valueOf (dbms_xmldom.item(nodelist,2),
    XPath);
    end getvalueat;

    analysis of procedure (xmlpayload varchar2) is
    doc dbms_xmlDom.DOMDocument.
    parser dbms_xmlparser. Analyzer;
    nodeList dbms_xmlDom.DOMNodelist;
    Testdoc varchar2 (2000);
    Start
    Parser: = dbms_xmlparser.newParser;
    dbms_xmlparser.parseBuffer (parser, xmlPayload);
    doc: = dbms_xmlparser.getDocument (parser);
    dbms_xmlparser.freeParser (parser);
    nodeList: = dbms_xslprocessor.selectNodes)
    dbms_xmlDom.makeNode (doc),'/ CAT. OBJMESSAGE_TYP');
    MyMsg: = objmessage_typ (null, null, null);
    MyMsg.from_userid: = getValueAt (nodeList, 'FROM_USERID');
    MyMsg.to_userid: = getValueAt (nodeList, 'TO_USERID');
    MyMsg.message: = getValueAt (nodeList, 'MESSAGE');
    end analysis;

    Start
    payloadXml: = ' <? XML version = "1.0"? >

    < CAT > OBJMESSAGE_TYP > < FROM_USERID > abcdabcd < / FROM_USERID >

    me < TO_USERID > < / TO_USERID > < MESSAGE > HI this IS SOME

    MESSAGE < / MESSAGE > < / CAT. OBJMESSAGE_TYP > ';
    Parse (payloadXml);
    v_from_user: = mymsg.from_userid;
    v_to_user: = mymsg.to_userid;
    v_msg: = mymsg.message;
    MyMsg: = objmessage_typ (null, null, null);
    v_from_user: = ";
    v_to_user: = ";
    v_msg: = ";
    end;


    I get the error message

    SQL > start
    2 myparsing();
    3 end;
    4.
    Start
    *
    ERROR on line 1:
    ORA-31011: XML parsing failed
    ORA-19202: an error has occurred in the processing of XML
    LPX-00231: invalid character 46 ('.) ') in a name a Nmtoken
    Error on line 4
    ORA-06512: at "XDB". DBMS_XMLPARSER', line 156
    ORA-06512: at "CAT. MYPARSING', line 27
    ORA-06512: at "CAT. MYPARSING', line 43
    ORA-06512: at line 2


    Can someone like me whats wrong in this code and the things I need to do

    TIA...

    It is not valid XML.

    See [spec | http://www.w3.org/TR/xml/#sec-starttags]

    Disallowed initial characters for Names include digits, diacritics, the full stop and the hyphen
    
  • Which is wrong with this query?

    SELECT THE PRODUCT. PRODUCT_ID PRODUCT. PRODUCT_DESCRIPTION, PRODUCT. PR_CURRENT_YEAR_SALES_GOAL, (ORDER_QUANTITY * PRODUCT_PRICE) AS sales so far
    ORDER, ORDER_LINE, PRODUCT, PRODUCT_LINE
    WHERE TO ORDER. ORDER_NUMBER = ORDER_LINE. ORDER_NUMBER
    AND THE PRODUCT. PRODUCT_ID = ORDERED_PRODUCT. PRODUCT_ID
    AND THE PRODUCT. PRODUCT_ID = PRODUCT_LINE. PRODUCT_ID
    AND THE PRODUCT. PRODUCT_LINE_NAME = 'Home Office ';

    There is something wrong with this request, but I don't see what it is. Anyone know whats wrong with it and perhaps what would be the correct way to request program?

    There is another thing that I noticed:

    You seem to have used a Table name: "ORDERED_PRODUCT. PRODUCT_ID' in your WHERE clause that is not in your FROM clause

    See you soon-

  • create the code with this code snippet

    I'm curious...

    I can't create a snippet of code with this code. (located in the first post)

    http://forums.NI.com/T5/LabVIEW/event-structure-with-value-changes/m-p/1937505#M646059

    However, I can create excerpts of its subsections.

    Tried different versions of LabVIEW with the same result.

    Can someone create a snippet?  Just curious.

    I'm not stuck or anything... just curious...  Maybe I should have posted the breakpoint...

  • What is wrong with this sequence, it does not work when, after 3 inserts, I add a new record with the trigger it gives an error.

    Mr President.

    What is wrong with this sequence, it does not work when, after 3 inserts, I add a new record with the trigger it gives an error.

    --SL_CUSTOMERS table data
    
    
    INSERT INTO SL_CUSTOMERS VALUES(1,'Kamrul Hasan',NULL,NULL,'Moghbazar', 'Dhaka','0456789123',NULL,NULL,NULL,'Y',NULL);
    INSERT INTO SL_CUSTOMERS VALUES(2,'Rabiul Alam',NULL,NULL,'Motijheel', 'Dhaka','0567891234',NULL,NULL,NULL,'Y',NULL);
    INSERT INTO SL_CUSTOMERS VALUES(3,'Shahed Hasan',NULL,NULL,'2-G/1,2-2,Mirpur', 'Dhaka','0678912345',NULL,NULL,NULL,'Y',NULL);
    
    
    
    

    CREATE SEQUENCE  "ALIZA"."SL_CUSTOMERS_SEQ"  MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 1 NOCACHE NOORDER  NOCYCLE ;
    
    
    CREATE OR REPLACE TRIGGER SL_CUSTOMERS_TRG 
    BEFORE INSERT ON "ALIZA"."SL_CUSTOMERS"   
    FOR EACH ROW   
    BEGIN   
    IF :NEW.CUSTOMER_ID IS NULL OR :NEW.CUSTOMER_ID < 0 THEN  
      SELECT SL_CUSTOMERS_SEQ.nextval   
        INTO :NEW.CUSTOMER_ID  
        FROM DUAL;   
      END IF;   
    END;   
    /
    
    
    
    

    When I try to insert several records with the seq.nextval it gives error

    violation of primary key.

    INSERT INTO "ALIZA"."SL_CUSTOMERS" (CUSTOMER_NAME) VALUES ('sdfsd')
    ORA-00001: unique constraint (ALIZA.SL_CUSTOMERS_PK) violated
    ORA-06512: at line 1
    
    
    
    
    One error saving changes to table "ALIZA"."SL_CUSTOMERS":
    Row 4: ORA-00001: unique constraint (ALIZA.SL_CUSTOMERS_PK) violated
    ORA-06512: at line 1
    
    
    
    
    
    
    
    

    Concerning

    Mr President.

    I find the solution by creating a function before the triiger

    as below

    CREATE SEQUENCE  "ALIZA"."SL_CUSTOMERS_SEQ"  MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 1 NOCACHE NOORDER  NOCYCLE ;
    
    CREATE OR REPLACE FUNCTION get_SL_CUSTOMERS_vId RETURN VARCHAR2 AS
    BEGIN
       RETURN SL_CUSTOMERS_SEQ.NEXTVAL;
    
    END;
    /
    
    CREATE OR REPLACE TRIGGER SL_CUSTOMERS_TRG
    BEFORE INSERT ON "ALIZA"."SL_CUSTOMERS"
    FOR EACH ROW
    DECLARE
    dummy VARCHAR2(200);
    BEGIN
      dummy := get_SL_CUSTOMERS_vId();
      :NEW.CUSTOMER_ID := dummy;
    END;
    /  
    

    It works very well

    Thank you all for the suggestions.

    Concerning

  • Please tell me what wrong with this paypal purchase code?

    < form id = "form1" name = "form1" method = "post" action = "" >
    " < p > < form action =" https://www.PayPal.com/cgi-bin/webscr "method ="post"> "
    < input type = "hidden" name = "cmd" value = "_s-xclick" >
    < input type = "hidden" name = "hosted_button_id" value = "PBG8WAM6N6G2S" >
    < table >
    < tr > < td > < input type = "hidden" name = "on0" value = "& quot; Showtime & quot;-paper print "> & quot;" Showtime & quot; - paper printing < table > < /tr > < tr > < td > < select name = "os0" >
    < option value = '1-11 x 14' > 1-11 x $14 50.00 < / option >
    < option value = '1-12 x 18' > 1-12 x $18 65.00 < / option >
    < option value = "1-16 x 20" > 1-16 x $20 90.00 < / option >
    < option value = '1-24 x 36' > 1-24 x $36 170.00 < / option >
    < / select > < table > < /tr >
    < /table >
    < input type = "hidden" name = "currency_code" value = "Us $" >
    " < input type ="image"src =" https://www.PayPal.com/en_US/i/BTN/btn_buynowCC_LG.gif "border ="0"name ="submit"alt ="PayPal - the safer, easier way to pay online how!"> "
    < img alt = "" border = "0" src =" " https://www.PayPal.com/en_US/i/SCR/pixel.gif "width ="1"height ="1"> "
    < / make >

    When I insert this code and try the button 'Buy' nothing happens.  My site is www.ritacortesi.com.  PayPal doesn't really have a good Web site.

    [email protected] wrote:


             

    method https://www.paypal.com/cgi-bin/webscr"="post">




    "Showtime"-printed paper ".


    https://www.PayPal.com/en_US/i/BTN/btn_buynowCC_LG.gif' border = '0' name = "submit" alt = "PayPal - the safer, easier way to pay online how!" >
    https://www.PayPal.com/en_US/i/SCR/pixel.gif"width ="1"height ="1">

    When I insert this code and try the button 'Buy' nothing happens.  My site is www.ritacortesi.com.  PayPal doesn't really have a good Web site.

    Look at the first line of what you posted.  You have 2 opening tags form it and I suspect that there could be other HTML errors on your page.  Run your page through the validator and fix errors that come back.  Once you have done this, if you still have errors after return.

Maybe you are looking for

  • Someone has charged my account for its Apple's music subscription

    I received an e-mail from Apple TM Inv. It's a bill of subscription of Apple's music for someone else.  I do not agree to the Apple's music. Could someone advise me please on what to do?

  • Audio driver

    I've updated a Compaq Presario V2000 (PV898AV) laptop from XP to Windows 7 (64).  The operating system works well, but missing a compatible audio driver that will work with Win 7 64.  Any ideas/help?   -Thank youSolved: Reinstalled under Windows 7 32

  • New computer falls a few minutes after connecting to the Internet.

    When I firstl newspaper in my internet computer will work fine, but after a few minutes, I get the dns server does not. How can I fix? My computer is new, I have troubleshooted my internet connection and all right? original title: WHY do I GET the SE

  • After trying to install sp1 on an Acer Aspire computer an error code came 0xc01a001.

    During the installation of sp1 on an acer aspire desktop is a 2006 or 2007 model and never had viruses, spyware or firewall protection load, the computer stops unexpectedly. There are 3 downloads, it was successfully downloaded and installed the firs

  • Incompatible print cartridge error message

    Below you can find a video on setting a cartridge print Incompatible error message in an Officejet J4680 printer. The steps it will show you how to do the following procedures. 1. Remove and inspect the cartridges 2. how to clean cartridges and what