What is the error in this package

Hi all

can you please tell me what is the error in this package please

SQL> CREATE OR REPLACE PACKAGE discounts
  2  IS
  3  g_id NUMBER := 7839;
  4  discount_rate NUMBER := 0.00;
  5  PROCEDURE display_price (p_price NUMBER);
  6  END discounts;
  7  /

Package created.

SQL>
SQL>
SQL> CREATE OR REPLACE PACKAGE BODY discounts
  2  IS
  3  PROCEDURE display_price (p_price NUMBER)
  4  IS
  5  BEGIN
  6  DBMS_OUTPUT.PUT_LINE ( 'Discounted '
  7  ||TO_CHAR(p_price*NVL(discount_rate, 1)));
  8  END ;
  9  discount_rate:= 0.10;
 10  END ;
 11  /

Warning: Package Body created with compilation errors.

SQL>
SQL> show errors;
Errors for PACKAGE BODY DISCOUNTS:

LINE/COL ERROR
-------- -----------------------------------------------------------------
9/1      PLS-00103: Encountered the symbol "DISCOUNT_RATE" when expecting
         one of the following:
         begin end function package pragma procedure form
         The symbol "begin" was substituted for "DISCOUNT_RATE" to
         continue.

SQL>

Hello

To ensure that the assignment is supposed to be part of the initialization section, that should run when the package is called or the first time?
The initialization section starts with BEGIN:

CREATE OR REPLACE PACKAGE BODY discounts
  IS
  PROCEDURE display_price (p_price NUMBER)
  IS
 BEGIN
  DBMS_OUTPUT.PUT_LINE ( 'Discounted '
  ||TO_CHAR(p_price*NVL(discount_rate, 1)));
  END display_price;

 BEGIN     -- required if there's an initialization section
  discount_rate:= 0.10;
END discounts;
/ 

Do you really need a section of initialization of the here? Discount_rate is already set to its initial value in the packet header?

Tags: Database

Similar Questions

  • What is the problem in this package?

    Hello
    I want to automatically generate a sequence number when a procedure is called. For this I wrote the code in a package,
    but his display error. I am uable to find out this error.plz take a look at this.
    CREATE OR REPLACE package body USER1.PACKAGE_TEST1 as
    initialCode varchar2(20);
    procedure SEQNUM(prefixCode IN varchar2,tableName IN varchar2,columnName IN varchar2,sequenceGenerated OUT varchar2,tb_cursor out md_cursor)
    as
    begin
    initialCode:=prefixCode||'000000001';
    open tb_cursor for
    SELECT NVL(SUBSTR(SUBSTR(MAX(columnName), 1, 1) || TO_CHAR(TO_NUMBER(SUBSTR(MAX(columnName), 2, 9)) + 1),1,1)||DECODE((10-LENGTH(SUBSTR(MAX(columnName), 1, 1) || TO_CHAR(TO_NUMBER(SUBSTR(MAX(columnName), 2, 9))+1))),1,'0',2,'00',3,'000',4,'0000',5,'00000',6,'000000',7,'0000000',8,'00000000')||SUBSTR(SUBSTR(MAX(columnName), 1, 1)|| TO_CHAR(TO_NUMBER(SUBSTR(MAX(columnName), 2, 9)) + 1),2,LENGTH(SUBSTR(MAX(columnName), 1, 1) ||TO_CHAR(TO_NUMBER(SUBSTR(MAX(columnName), 2, 9)) + 1))-1),initialCode)  FROM tableName
    end SEQNUM;
    end PACKAGE_TEST1;
    There is no problem in the sql query that is written for the automatic generation number.

    It smells all around a bad design.

    The appearance of your code, you try to sequence generation.

    Your attempt fails on a few levels.
    (1) concurrency (jet of several users at this and watch the sadness ensue)
    (2) performance (especially if you get help to fill in the part "dynamic past in the table name ' of the present).

    I STRONGLY recommend that you look at the use of Oracle sequences. Or, if it is not a viable option for a reason, let us know why so we can better suggest a plan of action for you.

    What I inferred from the post so far, you head down a road, you regret in short mode.

  • What is the error in this code?

    Hi all

    Please tell me what's not in the present code:

    Page {
        id: page_Aya
        property int  currentTrack:2
      content: Container {
       ListView {
            id: myListViewAya
    
            dataModel: dataModelAya
    
            listItemComponents: [
    
            ListItemComponent {
                    type: "item"
               Container {
                id: listItemComponent_Aya
                  // background: Color.create("#75b5d3")
                   Label {
                       id:label_Aya
                       text: ListItemData.id
                textStyle.color:(listItemComponent_Aya.ListItem.indexPath[1] == currentTrack) ? Color.Red : Color.Blue // line of Error
                   }
                }// end of Container
            } // end of ListItemComponent 
    
            ] // end of listItemComponents list
    }end of ListView 
    
    }end Container
    
    }end page
    

    I get the error:

    ReferenceError: Can't find variable: currentTrack

    Help me correct code please

    It is a question of importance. You must reference out of the ListItemComponent. There are tons of forum threads explaining how to get this.

  • my computer will not install itunes 10.5, it tells me "Setup has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2330.

    original title: Itunes problem

    my computer will not install itunes 10.5, it tells me "Setup has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2330. "What should I do?

    Contact the manufacturer (Apple) of the application (iTunes) you are having problems with.

    Uninstall all previous versions, try to download (re-record not running) and then do a right click on it and RUN AS ADMINISTRATOR.

    (Vista 32-bit or 64-bit)?

  • LDIF syntax error: what is the reason of this failure when you try to import the new user

    What is the reason of this failure when you try to import the new user, followed the book syntax

    C:\Users\Administrator\Documents>ldifde-i f Newusers.ldf
    Connecting to "practice01.testa01.com".
    Registration as current user using SSPI
    Import directory of the file "Newusers.ldf".
    Loading entries.
    There is a syntax error in the input file
    Failure on line 3.  The last token starts with 'C '.
    0 entries modified with success.
    An error has occurred in the program

    Hello

    The question you have posted is related to LDIFDE with Active Directory in a domain environment, and would be better suited to the TechNet community. Please visit the link below to find a community that will provide the best support.

    http://TechNet.Microsoft.com/en-us/default.aspx

  • What is PXE - 61 media test failed error and the error PXE - MOF? What is the solution for this error? It's a lenovo with windows desktop

    I have a lenovo computer. I began as routine but unfortunately it says error:-what is media test failed error PXE - 61 and the error PXE - MOF? What is the solution for this error? It's a lenovo with windows desktop computer? How do I prevent this.

    Kala

    Hello Mohan,

    ·         You did changes to the computer before the show?

    These errors often occur if there are incorrect BIOS (Basic Input\Output System) settings.

    Method 1: Check if the computer startup options are changed in the BIOS. You can set the hard drive as the first boot device. In addition, make sure that this option "Wake on LAN" or one similar to it is off.

    Method 2: Load default BIOS (Basic Input\Output System) settings, and then restart the computer.

     

    Important : Change/update BIOS can be a complicated process, and if an error occurs, your computer could be rendered inoperative. Be sure to observe the instructions of the manufacturer.

  • What is the error code 646? I get this when I try to install the update KB977304. Have tried several times.

    What is the error code 646?  I get this when I try to install the update KB977304.  I tried to install this update several times.

    Look at the point previously addressed in http://social.answers.microsoft.com/Forums/en-US/vistawu/thread/30624d26-942d-49ad-88b2-250514e92a9a/ I hope this helps.
    Good day.

  • What is the error code 4 on big fish games

    recently, I tried to down load new adventure games using windows vista.
    I had no problems before with this. I have no problem downloading all other games, just the recent adventure games.
    Also, I try these games on an experimental basis of 1 hour. I looked for answers through big fish Games forums. no luck.
    could someone help me with this problem. also, what is the error code 4 while trying to down load these games. It also seems to only the most recent collectors edition adventure games.

    Hi Woobby,

    Please go back and let us know the status of the issue.

    I suggest you to post the same question in BigFish forums to get help and to check.

    http://forums.bigfishgames.com/forums/list.page

    In case you have any questions about the Windows operating system, please post on the Microsoft Community Forums and we will be happy to help you.

  • How I download 80070103 windows update is update safe what is the problem with this update

    Just got the update installation today to download update 80070103 time ever I go to download the update fail what is the problem with this update & how do I get updated.

    Hello

    Thanks for posting in the Microsoft Community.

    If I understand correctly that you have problems with Windows Update.

    Please answer these questions:

    1. What is the update's KB number?

    2 have you made any changes to the computer before the show?

    Let us try the following methods:

     

    Method 1: Run the following fix - it:

     

    The problem with Microsoft Windows Update is not working:

    http://support.Microsoft.com/mats/windows_update/

    Method 2: See the following article:

    Windows Update 80070103 error code:

    http://Windows.Microsoft.com/en-us/Windows-Vista/Windows-Update-error-80070103

    Hope the helps of information. We know if you need help. We will be happy to help you.

  • What is the error code 0 x 80520012

    fact any body knows what is the error code 0 x 80520012

    Hello

    It helps if you tell us what you were doing when you got this error code

    What operating system, etc., etc.

    read this

    How to ask a question

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

  • What does the error code 80070005?

    What does the error code 80070005?

    If it related to Windows updates, this could be the underlying issue: http://answers.microsoft.com/en-us/windows/forum/windows_other-windows_update/vista-error-code-80070005-cant-install-windows/7a0e2719-1353-458c-8c88-2e6bc9e8f906

    Or: http://social.technet.microsoft.com/Forums/en/itprovistasetup/thread/95edbee4-a75c-48ad-91d1-5316a96f9567

    J W Stuart: http://www.pagestart.com

  • I don't know excatly what is the error code, because I don't have a laptop now.

    I don't know excatly what is the error code, because I have not portable right now.

    But my problem is this, my laptop has a one touch recovery key, but hard drive had change, so the recovery partition also ends. When I want to create, problem occurs during activation, windows can not be activated.

    Please help me.

    Without you telling us the exact brand and the model number of your laptop, the only advice is to contact the manufacturer of the laptop computer and ask for some advice from one of their experts to support troubleshooting. Carey Frisch

  • What does the error code 80240016? my computer will not install updates

    What does the error code 80240016? my computer will not install updates!

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

    Error message when you try to install the updates on the Windows Update Web site or the Microsoft Update Web site: "0 x 80240016.

    If the above does not resolve the problem:

    Windows Update Forum:

    It comes with Vista, upgrade install and activate Forum.

    You will get the best help for any problem of Update/Service Pack in the Windows Update Forum; the link below:

    http://social.answers.Microsoft.com/forums/en-us/vistawu/threads

    When you repost here, kindly include the Error Codes, and exactly what is happening when you try to update.

    In this way, you will receive the best help.

    See you soon.

    Mick Murphy - Microsoft partner

  • What is the solution to this very difficult replication scenario?

    We develop an integration for a customer solution. Client is in the medical industry.

    Scenario is the following:

    (1) there are 26 different DBs in 26 different servers. Say 1 MED... 26.

    (2) it is an integration of DB on a separate server: say INT0

    (3) every MED DB will have a table named TABLE1.

    (4) you must read the inserts to the table and to treatment and introduce to the common table of queue (called QUEUE0) in INT0 DB.

    (5) we can create all the DB objects in DBs MED. We have access to these only by using the links to the DB.

    My solution:

    (a.) create links of 26 DB in the INT0 server.

    (b) to create 26 MVs Server INT0 SCHEMA1.

    Mv_med1 CREATE MATERIALIZED VIEW

    BUILD IMMEDIATELY REFRESH to START WITH (SYSDATE) NEXT (SYSDATE + 1/1440) WITH rowid

    AS SELECT * FROM table1@dblink_med1;

    Thus, SCHEMA1 of INT0 DB will have 26 MVs pointing to 26 tables in 26 different DBs.

    (c) now, I create an insert after outbreak in each of the 26 VM.

    CREATE OR REPLACE TRIGGER trg_mv_med1

    AFTER INSERT ON mv_med1

    FOR EACH LINE

    BEGIN

    INSERT SCHEMA1. QUEUE0 VALUES (: NEW.pk,: NEW.remarks);

    END;

    (d) it works. This is, whenever the refresh occurs, all THE ROWS are inserted in the MV. So I get the lines in the table QUEUE0.

    What is the solution to this type of problem?

    I read on DBMS_SNAPSHOT. I_AM_A_REFRESH, but I do not understand how it works?

    We cannot create a MV connects patterns MED being customer policy.

    Any solution to this problem would be greatly appreciated?

    In general no. When there is a problem on the network and link DB is not workning then write data to the exception handler table using the same DB connection will fail again. You need to connect to a local table in DB MEDx. Create a job that to copy table data of the local error log of MEDx DB DB INT0 regular interval.

    If I were you I write all data to the local tables - it's safer and faster (no distributed transaction and no two-phase commit).

    Then create jobs that periodically copy data from local INT0 DB tables.

  • Hi What is the error code 201?

    Hi What is the error code 201?

    Please see:

    Hope this will help you.

    Kind regards

    Hervé Khare

Maybe you are looking for

  • 2000-2d62TU-driver graphic HP laptop

    I am trying to find drivers for the graphics in this laptop. For the life of me I can't find any documentation that specifies what, exactly, the type of GPU is in this machine.I am running Windows 7 64 bit. There is no graphics driver listed in the u

  • (Redirected) Are there tools for Samsung PM851 SSD SSD?

    I just got my Area 51 with a Samsung SSD desktop computer. Dell/Alienware has a toolkit for this SSD I can download? I looked at the Samsung website and found the software Samsung magician, but he said that he did not support this drive. The features

  • Install HP Solution Center

    I need to reinstall my HP 4480 HP solutions Center and cannot find a way to do it. Thank you

  • Troubleshooting said printing problem fixed, but this is not

    I am running Windows 7 with a Dell 720 photo printer. I had to download a printer driver, the printer is not compatible with Windows 7, but support Dell says I put everything. Everything was fine for a while. Then a gummed up print job works. Nothing

  • How to make Windows 7 genuine that I lost my product key?

    Original title: genuine windows How to make my 7 genuine windows? I lost the product key and now I want to do it genuine.plz tell the solution