Home » SQL & PL/SQL » SQL & PL/SQL » Package
Package [message #189823] Mon, 28 August 2006 00:32 Go to next message
sam4all
Messages: 29
Registered: August 2006
Location: Bangalore
Junior Member
Hi,

Package contain 5 procedure
But these 5 declared in Packege specification ,but only
4 declared in Package Body.
Will it compile ? what will be result

In another package 5 procedure ,one declared in package
specification remaining all declared in Package body .
what is the result??

regards,
Re: Package [message #189828 is a reply to message #189823] Mon, 28 August 2006 00:54 Go to previous messageGo to next message
dhananjay
Messages: 635
Registered: March 2002
Location: Mumbai
Senior Member
hi,

let me put it in simple terms.

 yes, it will compile .any sub program,
variables etc declared in the specification 
is available to other applications.
it's called a public declaration.
but if it's only appears in the package body it becomes a private and can only be
used within the same package.

note : a package specification can exist without a package body.but , not vice - versa.


regards,

[Updated on: Mon, 28 August 2006 00:55]

Report message to a moderator

Re: Package [message #189841 is a reply to message #189823] Mon, 28 August 2006 01:21 Go to previous message
Frank
Messages: 7880
Registered: March 2000
Senior Member
Quote:

Package contain 5 procedure
But these 5 declared in Packege specification ,but only
4 declared in Package Body.
Will it compile ? what will be result

Simple, just test it yourself!
SQL> create or replace package faq
  2  as
  3  procedure prc1;
  4  procedure prc2;
  5  end faq;
  6  /

Package created.

SQL> create or replace package body faq
  2  as
  3  procedure prc1
  4  is
  5  begin
  6    null;
  7  end prc1;
  8  end faq;
  9  /

Warning: Package Body created with compilation errors.

SQL> show errors
Errors for PACKAGE BODY FAQ:

LINE/COL ERROR
-------- -----------------------------------------------------------------
4/11     PLS-00323: subprogram or cursor 'PRC2' is declared in a package
         specification and must be defined in the package body

If you want to learn Oracle, play with it. Just asking questions here will not help. Test it, try it yourself and when you are stuck, or you don't understand something, search the internet and THEN come here and ask.
This is definitely the best way to learn. If you find the answer yourself, it will stick; if you are spoonfed an answer you will forget.

Previous Topic: callin oracle stored procedures in Vb
Next Topic: executing a package.procedure
Goto Forum:
  


Current Time: Thu Dec 08 18:17:26 CST 2016

Total time taken to generate the page: 0.11984 seconds