Why a semi-colon is not enough when creating packages and package bodies?

Hi,
I'm struggling with a quite simple problem - when creating a package header and body in the same script, it does not work as expected. See for example this very simple package:
CREATE OR REPLACE PACKAGE mypackage AS
PROCEDURE test_proc(id INTEGER);
END mypackage;
CREATE OR REPLACE PACKAGE BODY mypackage AS
PROCEDURE test_proc(id INTEGER) IS
BEGIN
NULL;
END test_proc;
END mypackage;
When executed from JDeveloper (or sqlplus), the package is created but with a "PLS-00103: Encountered the symbol CREATE" error. It seems Oracle does not recognize the script contains header and body, and uses the whole script as a header (which is obviously wrong).
If modified so that there are "/" everything works fine:
CREATE OR REPLACE PACKAGE mypackage AS
PROCEDURE test_proc(id INTEGER);
END mypackage;
CREATE OR REPLACE PACKAGE BODY mypackage AS
PROCEDURE test_proc(id INTEGER) IS
BEGIN
NULL;
END test_proc;
END mypackage;
Why is this necessary? Why Oracle does not recognize that "END mypackage;" actually ends package header definition, and combines it with the body definition into an invalid block? I've thought semicolon is a valid separator, so why is the "/" necessary?
It does not work even when I try to run the statements separately (from the same worksheet in Jdeveloper) - first select the header block, hit F9 (execute statement), then repeated the same for body. In this case both header and body are created, but are invalid because the last semicolon is removed from them (so it's not possible to compile them).

For that to work, the SQL engine would have to understand PL/SQL syntax. Only the PL/SQL compiler knows when all the END statements have matched up with their corresponding declarations, and it doesn't do CREATE statements. I guess it could detect that the compilation unit it started has finished and pass any text left over back up to SQL to have another shot at. I'm not sure that's reasonable. There is no other example in SQL where one CREATE statement can turn into two - e.g. you can't send a block of CREATE INDEX statements together and expect the database to parse them out into separate commands.
Edited by: William Robertson on Jun 6, 2009 6:49 PM
Edited by: William Robertson on Jun 6, 2009 6:51 PM
Added example about indexes.

Similar Messages

  • Data target is not available when creating an info package in BW

    Hi,
    I am not sure how, but I have accidentally deleted the info packages for one of the info sources. I have created init package successfully, but when I try to create a delta info package for the data mart, the data target( which is an info cube) is not appearing in the data target tab.
    Any help in this issue is higly appreciated.
    Thanks
    Prashant

    PRASHANT ASOPA , did you find a solution to this - I am facing a similar situation! I have tried almost everything including deleting and recreating the update rule, recreating the export datasource, activating everything a couple of times and of course cretaing and deleting info packages, but no matter what I do I can't get the system to recognize the data target.
    The "funny" thing is that everywhere else, even in the "Show data flow" everything looks right!

  • WHY DOES IT SAY BATTERY NOT CHARGING WHEN I TRY TO CHARGE MY IPAD??

    WHY DOES IT SAY BATTERY NOT CHARGING WHEN I TRY TO CHARGE MY IPAD ???

    How are you trying to charge it, via a computer or the wall plug ? If a computer, then a lot of computers (especially older ones) generally do not provide enough power to their USB ports to charge the iPad at a sufficient rate - it may still be charging slowly, and should be a bit quicker if the iPad's screen is off (if you leave it for a while and then disconnect it from your computer you may find that it's battery percentage has gone up). The wall charger is usually the most efficient way to charge the iPad.
    If the wall charger then have you tried a reset to see if it charges after the iPad has restarted ? Press and hold both the sleep and home buttons for about 10 to 15 seconds (ignore the red slider), after which the Apple logo should appear - you won't lose any content, it's the iPad equivalent of a reboot.
    If that doesn't work then have you tried a different charger and/or cable ? Do you know anybody else with an iPad so that you can try their charger and cable and they can try yours ?
    And for info typing in capitals is considered SHOUTING.

  • My iphone 4 has a SIM card and lately is saying that it is not installed when it is, and it has a small light in the screen where the card goes into the slot, why is this happening?

    my iphone 4 has a SIM card and lately is saying that it is not installed when it is, and it has a small light in the screen where the card goes into the slot, why is this happening?

    Hi cosmoph1,
    If you are having issues with your iPhone not recognizing the installed SIM, you may find the following article helpful:
    iPhone: Troubleshooting No SIM
    http://support.apple.com/kb/ts4148
    Regards,
    - Brenden

  • Why is my message textbox not empty when i try to write a new message

    Hi all i am having this problem,
    why is my message textbox not empty when I try to write a new message. How to get rid of those text in the new message.

    I have this same problem.
    Everytime I start a brand new text it has an old message already in the text box

  • Why does my ipad say "not charging" when plugged in?

    Why does my ipad say "not charging," when plugged in?

    http://support.apple.com/kb/HT4060
    Read the KB article.  Make sure you are using the 10W adapter that came with the iPad or a High-Power USB 2.0 port.

  • Why "stop download video" feature not show when playing video

    why "stop download video" feature not show when playing video,, i hope you can give me Solution for this problem because when i using 3g internet, it downlaod the video Quickly ,,, so it consume the Balance

    Do you have Flash installed?   Check HD > Library > Internet Plug-Ins
    If the Flash Player app is not in the Internet Plug-ins folder, download and install from here.
    When you post for help, please state which OS X is installed.
    If you aren't sure, click About this Mac from your Apple menu 
    Troubleshooting advice can depend on that information.

  • Why does SMS tell me "not allowed" when I try to add an existing contact to one of my SMS Groups?

    Why does SMS tell me "not allowed" when I try to add an existing contact? 

    If you are running Tiger, you don't have time machine. 
    You need to get something like SuperDuper! or Carbon Copy Cloner (sorry, I don't have a handy link for CCC but you can Google it to get their site) to make a clone of your drive on the external and then do incremental backups.  The free versions do a lot and you can upgrade to the full-service versions for small change if you need more.  The one time I used SuperDuper! for cloning a volume it worked just fine. 
    (My backup application is the last PPC capable version of Retrospect, which does a credible job, or has over the past ten-twelve years.)

  • Why does the loan token not transfer when a book is transferred to a Nook?

    Why does the loan token not transfer when a book is transferred to a Nook?

    Hi laura,
    I suspect that your 2 decimal place numbers are formatted as text. Change the format of the column to currency and see it that works.
    Also You might want to update your profile to reflect your current systems!
    quinn

  • PSE 8 some photos will not autoimport when creating an photobook and block the whole sequence. Are there knows reasons why individual photos can hang the import? Thanks Michael

    When creating photobooks with PSE 8 I find occasionally that certain photos block the autoimport function and none of the sequence are loaded into the new photobook. Using the identical setting to create a photobook other sequences of photos work perfectly. The photos have been checked and found and all are connected and recognised. Are there knows issues with some photo formats which will not autoimport when creating a photobook?
    Thanks for the help.
    Michael

    Sometimes LR can be "nudged" into showing folder relationships which better match the file system, by using the "show parent folder" command. When existing folders appear as if they were "top level" in the drive, we can see a more or less virtual picture of the situation, rather than anything real. So newly added folders can sometimes present themselves as if independent of what is already there.
    By forcing LR to show a fuller hierarchy of folders, more attention gets paid to the actual arrangement - so new and existing folders should "wake up" and thereafter appear more reliably in the right relationships.

  • Partner function not working when creating PO with ref to PReq

    Partner function is not working when creating a Purchase Order with ref to a Purchase Requistion, Partner functions maintained in the vendor master are VN, OA & PI.
    But OA & PI are not appearing in the PO header partner tab when created with ref to PR.
    however it works when i create the PO directly ( without the PR ref )
    I am using the same material & Plant for both manual PO & PR to PO.
    Any idea what could be wrong .
    I have maintained the settings for schema groups for vendor master & purchasing doc in the partner determination.
    Thanks
    Dkmurthy

    Hi,
    I have also an issue that seems similar to one you are discussing.
    When we use ME59N and create a PO with ref. from a PR (created from a sales order), the message determination works well, it reads the condition set in MN04 (condition records for messages), and creates a message (with output type for EDI , medium: 6, and partner function LS: Logical system). Message is created and idoc is sent.
    When we try with ME21N, ME21 and we create the PO with ref. to the same PR, either by entering manually the PR in the document overview of ME21N or by selecting the PR (without entering the PR number), i.e with date, the message is not created in the PO.
    Company code is assigned to purchase organization, and so is purchase organization to plant.
    Any idea why there is no automatic message determination in the case of the transaction: ME21N
    Note: If I try ME21N, and enter the output type and partner, manually, I receive a warning message
    VN006 (Partner XXXX does not exist for partner function LS). If I accept this warning message, then message is saved- idoc is sent. However I can not overcome the warning message, if it plays any role, because I can not assign partner function LS to the vendor.Then I receive message CZ 327 (Can not use this partner role).
    Any input is wellcome.

  • There's a not enough storage message appearing and I can't get rid of it.

    There's a not enough storage message appearing and I can't get rid of it.

    A reset may help: Tap and hold the Home button and the On/Off button at the same time for approximately 10-15 seconds, until the Apple logo reappears. When the logo appears, release both buttons and await restart.

  • Photoshop CC. Colour selection not working when using alt and brush.

    Hi, Photoshop CC. Windows 8.1 64 bit. Colour selection not working when using alt and brush. I have tried rebooting and other things like closing swatch panel etc.
    The alt key is otherwise OK.  It's not the recent upgrade from Win 8 to 8.1 (5 days ago) because the colour selection facility was working yesterday. Any ideas.

    I'd say things sound desperate enough to try resetting Preferences
    Reset Preferences
    Windows — Hold down Shift Ctrl Alt immediately after starting Photoshop
    Mac — Hold down Shift Cmd Opt immediately after starting Photoshop
    If that fails, we need to know your operating system?
    Do you have a full CC subscription, or by apps do you mean Photoshop, Bridge and Lightroom?
    Another other information that might pertain ?

  • Why will my icloud calendar not sync between my iphone and calendar on Outlook PC?

    Why will my icloud calendar not sync between my iphone and calendar on Outlook PC?

    I think I may be having the same issue In a round about kind of way.  Just got an iPhone4S ... everything worked great until today when I started tinkering with the settings in my new phone and noticed my cloud was getting full and I had two iPhone back ups on there at 4GB a piece.  So.... I deleted the old back up of the iPhone4 and after that is when I started noticing issues.  The cloud on my phone can no longer authenticate itself , unable to tell me when the last back up was, and will not perform a back up at all. Furthermore I am unable to download apps or updates on my iphone4S, they all sit in "waiting" status....
    I also must say that I purchased an iPad 2 and still have my original ipad in the house and active.  Both back ups are in the cloud and both devices work fine independently and can download apps and back up fine as well. I'm pretty sure this may be the culprit concerning this issue and I too have no idea how to fix it. Please Help!!!

  • My ipad mini does not restart when i press and hold the home and power buttons for a minute or more. what do i do? i really need to access some information on it. please help.

    my ipad mini does not restart when i press and hold the home and power buttons for a minute or more. what do i do? i really need to access some information on it. please help.

    You need to connect to iTunes and restore.
    iOS: Not responding or does not turn on
    You may need to put the device into recovery mode, this is covered in the link on this page.
    Did you back up the device?

Maybe you are looking for

  • How do I turn off home sharing on devices I can no longer access?

    I have an old iPhone and an old PC which I no longer have access to (the iPhone is broken beyond fixing and the pc I gave up on months ago) I would like to remove them from my home sharing list to open up room. With the two unused devices I have the

  • After upgrade to Snow Leopard, unable to connect to secure WiFi network

    Hi all- I recently upgraded from Leopard to Snow Leopard on my MacBook Pro. Immediately following the upgrade I found I could no longer connect to my home wireless network (WEP encrypted, D-Link router) which was working just fine before the new O/S

  • Upgrading nokia 5230 to Firmware 2.0?

    I recently got a new Nokia phone! It has the firmware for v.12.8.095 When I run the Nokia Software updater it tells me that my firmware is up to date.  How can I upgrade to v 2.0?

  • Support for Progress Database

    Hi, I have a requirement to pull data into HANA from MFG PRO system that runs on Progress database, does SLT support it. Please advise. Thanks.

  • Conversion of Non Valuated GR order to Valyated GR order.

    Dear Experts, We are using assembly porcessing method to genrate production order alongwith Sales order i.e. strategy 82. A  mistake occured in configuartion of req,t class 202 is that field  valuation is blank . Due to this , all production order cr