One_time only procedure

hi,
what is use of one_time_only procedure,
i have example in which implemented in package .
example..
create or replace package ase
is
do1 number;
end ase;
create or replace package body ase
is
begin
select sal into do1 from emp where empno=7369;
end ase;
variable a number
exec :a := ase.do1;
print a
A
1300
what is purpose of one time procedure please any one help....

Hi,
Like Someoneelse, I'm not sure what you're asking.
There are no procedures of any kind in that package.
When you have a BEGIN section in the package body, then that section is executed once per session, the first time you reference the package. Typically, it is used for set-up, often of package variables 9as in your example) or global temporary tables that are needed elsewhere in the package. If there was something special about employee 7369's salary, and you had to reference that over and over in the package, then it would make sense to declare a package variable (such as do1, though I would suggest a more descriptive name), and set it in the BEGIN section, especially if you can assume that value will not change in the course of the session.
I have one package that sends e-mails where I do exactly that. The name of the e-mail server is located in a table. (I don't want to hard-code it in the package, because my Development database can;t use the same e-mail server as my Production database, and they change about once a year anyway.) I read the name iof the e-mail server once, when I call the package; it looks up the value in the table, and I never have to touch that table again for the rest of the session.
It looks like this "one_time only procedure" question got posted 3 times. That's probably not your fault; this site can be very flaky. To save time and confusion for everyione (including yourself), please mark the other threads
http://forums.oracle.com/forums/thread.jspa?threadID=2199251&tstart=0
http://forums.oracle.com/forums/thread.jspa?threadID=2199249&tstart=0
as "Answered" right away.
Edited by: Frank Kulash on Mar 29, 2011 12:52 PM
Added e-mial server example.

Similar Messages

  • How to import only procedures, functions, and packages only

    Hi everybody...
    How to import only procedures, functions, and packages only from one user to another user.
    Thanks in advance
    pal

    Thanks for your reply...i did the following..can you please help from this how to proceed
    ---------------- getcode.sql -------------------------------
    set feedback off
    set heading off
    set termout off
    set linesize 1000
    set trimspool on
    set verify off
    spool &1..sql
    prompt set define off
    select decode( type||'-'||to_char(line,'fm99999'),
    'PACKAGE BODY-1', '/'||chr(10),
    null) ||
    decode(line,1,'create or replace ', '' ) ||
    text text
    from user_source
    where name = upper('&&1')
    order by type, line;
    prompt /
    prompt set define on
    spool off
    set feedback on
    set heading on
    set termout on
    set linesize 100
    ------------------- getallcode.sql -------------------------
    set termout off
    set heading off
    set feedback off
    set linesize 50
    spool c:\xtmpx.sql
    select '@getcode ' || object_name
    from user_objects
    where object_type in ( 'PROCEDURE', 'FUNCTION', 'PACKAGE' )
    spool off
    spool c:\getallcode_INSTALL
    select '@' || object_name
    from user_objects
    where object_type in ( 'PROCEDURE', 'FUNCTION', 'PACKAGE' )
    spool off
    set heading on
    set feedback on
    set linesize 130
    set termout on
    @xtmpx.sql
    I did this one user and created the xtmpx.sql
    and getallcode_INSTALL.LST.
    From this, how to proceed to run these in another user.
    Thanks,
    Pal

  • One-time only procedures

    My one-time only procedures (i.e. those defined at the bottom of
    a package body and not a part of any other procecures/functions)
    seem to run more than once. My understanding is that they should
    only run once upon instantiation but they run each time the
    package is called. Am I doing something wrong? Is there some
    server process that recompiles packages on the fly?
    Thx.

    Ooops. never answer a question before the second coffee of the
    day.
    Yes, I should have said that the initialisation segment is run
    once for each session. if you run a procedure, log out, log
    back in and run it again then the initialisation segment is
    executed again.
    so my advice was correct even if my explanation was muddled.
    apologies, APC

  • Difference between creating one-time-only procedures and regular procedures

    I understand the definition of one-time-only procedures but when I look at the code examples, I do not see any differences. Can you shed some light on this for me? Thanks!

    Are you talking about the initialization block of a package?
    If so, that is a PL/SQL block that only exists in a package body, not in a procedure. The syntax within the initialization block is no different than the syntax within a procedure, function, anonymous PL/SQL block, or any other PL/SQL block.
    Justin

  • How to give grant permission on packaged procedure

    Hi ,
    This is Ramesh  what is my requirement is i want give permission packaged procedure that means i given permission  only procedure not entire package it is possible or  not? if yes then why
    given example

    Hi,
    You  can't  give grant to package.function or procedure.
    You  can do that following way.
    SQL> create or replace package p is function f return number; end p;
      2  /
    Package created.
    SQL> create or replace function f return number is begin return p.f; end;
      2  /
    Function created.
    SQL> grant execute on f to scott;
    Grant succeeded.
    Regards
    Mahir M. Quluzade

  • Visual Basic, DAO, Temp tables in stored procedures

    Client code currently uses DAO with SQLPassthrough option in VB to connect to SQl 6.5 db.
    I migrated all stored procedures with default options except Oracle 8i temp tables. For every procedure a package and a procedure was created. We use SQL server temporary tables extensively in a few hundred stored procedures. The ref cursor created refers to the temporary table. While migratiing, Create table statement is commented. How are SQL6.5 equivalent of temp tables handled in Oracle? Is there an alternative to temp tables?
    I also migrated to another oracle db using the INOUT type for stored procedures. This time only procedures were created. Can these procedures return a record set in DAO with SQLPAssthrough?
    How do you call a procedure using DAO in VB to get recordsets?
    What is the best way to migrate to Oracle with minimal client code changes?
    Thank you in advance.
    Umesh
    null

    Karthick_Arp wrote:
    BluShadow wrote:
    I agree with Karthick, there's no need for a temporary table in this situation.
    And to add, temporary tables should not be created at runtime, they should be part of the initial design of the database, created once and used as needed. Creating them at runtime is just wrong.The problem is the name oracle has given to GTT. The word Temporary mislead lot of SQL Server developers and they think its something same as the temporary table used in SQL Server :)Yeah, Ingres does something similar to SQL Server too, in that you can create a temporary table (Ingres assigned it a unique name and tells you what it is), and you set an expiry time on it (i.e. set it to expire in 1 days time), and then a background process is supposed to clean up the tables that have expired. Unlike Oracle, they are not session specific, but become visible to all once created.
    I think there's room for both types of temporary table, but Oracle's does the job (except when you want to use them from a stateless application front end).

  • Package Body in the tree doesn't show all procedures

    I am using Sql Developer 1.0.0.14.67 on Win XP Professional,
    DB servers Oracle 9i on both Linux Red HAt and Win XP Professional
    I have troubles with one of packages - in the tree under Package Body SQL Developer doesn't show all procedures of this package body.
    On the right panel all package body source is shown, but in the tree under Package Body it shows names of only procedures up to certain line in the source code - up to line where first Private (not included in Package Spec) procedure code starts.
    BUT, there are more Public procedures in package body below this Private procedure - and all of procedures below first private are not included in the tree under Package Body

    I find this quite annoying. I cannot use the navigation panel on the left to find the location of all functions and procedures in the package body. The 'missing' procedures are listed under the package spec, and double clicking on them takes me to the spec and not the body.
    I'm running v1.2.1.32.13. Is this a know issue and is there a fix planned?

  • Migrate MS SQL Server procedure to Oracle

    Can any one suggest me any user friendly tool to Migrate MS SQL Server procedure to Oracle. I think using OMWB we can migrate schemas, as i could not find any interface to migrate a single procedure

    I tried using swisssql, but the trial version only migrates 10 tables and 10 indexes and no other objects. Is there any other tool which shall migrate only procedures? If so plz suggest me.....

  • How to call a write procedures which has output parameters in an xsodata service?

    Hi,
    I have a use case where we call a Stored procedure from an xsodata service, where in I also need some output from procedure.
    We couldn’t achieve this because whenever I pass some output from my procedure , framework is considering the response as an error always.
    Looks like we cannot pass back any values apart from errors.
    Since we are doing some insert statements in our procedure I couldn't even wrap the procedure using calculation view
    because from calculation view we can call only call only read only procedure.
    What is the right way of calling a write procedure which returns some output always apart from error from an xsodata service?
    Thanks and Regards,
    Arjun

    Another suggestion Arjun,
    you said you have a writeable procedure with you, which will return a result set after the processing. You split the procedure into two, one writeable and one read only, so that the writeable will update the data, and read only procedure would return the required result set. The, use xsjs to call the writeable, and use xsodata to call the read only procedure(complicate it man ). 
    Sreehari

  • View defination privileges on Procedures for any user

    Hello,
    I was looking for some query where i can view the defination or select the procedures of any schema
    for example we have procedures owned by ML schema, other users such as fft, fft_read etc wants to view the defination of the procedures or select privileges on the procedures owned by ML Schema.
    is there anything like grant select any procedure owned by any schema can view the procedures by all other schema's in the database.
    Thanks

    Thanks for your response.
    These are the procedures owned by other schema not by FFT and FFT read.
    and i need only procedures not other objects.Connect to the schema who owns the Procedures and Issue,
    Grant debug on owner.object_name(Procedure) to FFT,FFT_READ;
    Or
    Just issue
    Grant debug connect session to FFT,FFT_READ
    Hope this helps.
    -Anantha

  • Current running sql statement in procedure?

    How to identify the current running sql statement in procedure or package? From the v$sqlarea, i can see the only procedure name with parameters, but not current execution statement? is there any dba view to know the current execution statement in 9i & 10g ?

    hi
    u can also use dba_source view to know which sql statement issued by which user

  • How to edit .HDB Procedure

    Hi All,
    I am new to HANA and I have requirement - need to modify the Stored procedure but I am not sure how to modify .
    I tried in Project explorer / repositories  - but error message is - You can only create a read-only procedure on this server in development server
    Pls find the attachment
    Regards,
    Sivakumar Ramakrishnan

    Hi Krishna,
    Still I am not able to edit the . HDB Procedure in project explorer  ,Pls find the screen shot and kindly Advice on this .
    I am not sure that I am editing at right place and also I am in support project ,The following procedure already available in Prod and I received some changes in this procedure ,Currently I not able to edit because procedure of type .HDB Procedure ,Not sure where to edit and I tried in Project explore but I am getting the following message ,Let me know any role need to assign to me or any schema mapping need to do .
    Regards,
    Sivakumar Ramakrishnan

  • Exp/imp procedures

    Is there anyway to export/import only procedures of the schema
    Oracle 10g

    If you are using 10g, you can specify include parameter in datapump like that:
    INCLUDE=PROCEDURE

  • Export Procedure,Function

    Hi all,
    I have oracle 10g on winodws 2000.
    I want to know that is it possible to take only procedure and function Dumpfile from schema.
    So that i can import that procedure and Function on production.
    Thanks,
    Neerav
    Edited by: Neerav999 on Jan 20, 2010 3:34 PM

    Hi,
    You can create the dml using dbms_metadata.get_ddl function and spool it in a file
    eg
    spool exp_proc.sql
    select dbms_metadata.get_ddl(OBJECT_TYPE,OBJECT_NAME,OWNER)
          from dba_objects
                where owner in ('<LIST of owner you want to export>')
                         and object_type in ('LIST of object type you want to export>')
    spool offRegards
    Anurag

  • Can we use OUT or IN OUT parameter mode in function?

    Can we use OUT or IN OUT parameter mode in function & if YES then what's limitations?

    hi,
    Yes we can have OUT and IN OUT parameters for a function.
    As per my knowledge there are no limitations , but as per the convention we will use OUT ,IN OUT Parameter modes for only procedures .
    Thanks,
    P Prakash

Maybe you are looking for

  • More than one computer iTunes sync

         I recently upgraded to a newer model of macbook pro.  My old one was 4 months too old to sync at all with my Iphone 5 (which is frustrating in itself).  When I'd gotten my iphone 5, I first synced it to my family's mac and transfered much of my

  • 10.9.2 update sleep issue with NEC monitors confirmed

    After updating from Mac OS10.9.1 to 10.9.2, both my friend, who lives in another city, and I find that attempting to put our MacPros (2010, think his is a 2009 model) attached to a NEC PA 301 (mine) or PA 271 (his) series pro monitors to sleep experi

  • Sharepoint 2007 to Sharepoint 2010 migration

    Hi, Does Microsoft recommends/support below techniques for SharePoint 2007 to SharePoint 2010 migration? Migrate SharePoint 2007 site to 2010 using save list as template technique: I use this technique. I have to delete all look up columns and add th

  • Pls suggest right BAPI  FOR  Tcode(MSC2N)

    Hi All, I am uploading the data(characteristic values) through the Tcode MSC2N When I am trying to do this through bdc it's not allowing to change characteristic values?What will be the problem?we can use the BAPI BAPI_OBJCL_CHANGE but this bapi will

  • Can't print pdf on NEW  MACBOOK

    I need to pring PDF files constantly as a musical director.  I am trying to print a score right now that was sent to me.  I goes to PREVIEW and then the little kaleidescope just spins..... HELP!!