• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

package body and spec in seperate file or in same file?

 
Ranch Hand
Posts: 937
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a package body named tss_app_body.sql and package spec as another file tss_app_spec.sql. my coworker saying these two can be combined to one file tss_app.sql. i said these two should be sperate and he is saying im wrong. so pls let me how it should be. any help appreciated
 
Ranch Hand
Posts: 8946
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I ran the command
@d:\test.sql
The out put was
Package created.

Package body created.
The file is
CREATE or replace PACKAGE emp_actions AS

PROCEDURE calc_bonus (date_hired DATE);
END emp_actions;
/
CREATE or replace PACKAGE BODY emp_actions AS
PROCEDURE calc_bonus (date_hired DATE) IS
-- parameter declaration raises an exception because 'DATE'
-- does not match 'emp.hiredate%TYPE' word for word
BEGIN null; END;
END emp_actions;
/
---
Hope this helps
 
sunitha reghu
Ranch Hand
Posts: 937
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
pradeep,
i have already created package but body in one file and spec in another file. que is making spec and body in one file make any diff. i know it will work but wanna know anyother diff?
 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sunitha,
One advantage of separating the package specs from the package body file is when you're running multiple package scripts, invalid reference error could be avoided. Suppose we have two package X and Y. Package X references Y. If we have only one file for both body and spec (X.sql and Y.sql), we have to run the Y.sql first before X.sql or else will have an invalid reference error. But it we separate the package spec and body files, we can run the specs file first (X_spec.sql and Y_spec.sql in any order) without considering the reference. Running the X_body.sql and Y_body.sql would then be reference error free since the specifications has been declared.
Hth,
Remar
 
sunitha reghu
Ranch Hand
Posts: 937
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks......
 
sunitha reghu
Ranch Hand
Posts: 937
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I aslo read its good idea to keep packages small fr pinning in to memory.also the pl/sql complier build an internal tree known as Diana.The max limit prior to 8i is 32k
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic