Stored procedure calendar basic questions

If I have the following statements in a stored procedure, what happens if a user performs an update, insert, or select this option for the MAIN_TABLE during the procedure (assume that the procedure takes a few seconds)?

MY_PROCEDURE:
INSERT INTO BACKUP_TABLE (COL1, COL2, ETC.)
(SELECT COL1, COL2, ETC. FROM MAIN_TABLE WHERE BACKED_UP = 'N');

UPDATE MAIN_TABLE SET BACKED_UP = 'Y' WHERE BACKED_UP = 'N';
If they do an update/insert, MY_PROCEDURE data will see that update/insert and send it to BACKUP_TABLE? Or it will depend on if this file has been processed yet? Or the update/insert will not persist until the procedure is completed? (I suspect the latter, but it's hard to get the timing right to test it myself)

Would there be problems doing a select on MAIN_TABLE while this process occur?

If there is a reference to how these timing issues are resolved that someone could tell me, that would be great; I can't find anything on mine.

When all else fails, read the Fine

http://download.Oracle.com/docs/CD/E11882_01/server.112/e16508/consist.htm#sthref1118

Tags: Database

Similar Questions

  • insufficient privileges when executing stored procedure

    Hello gurus,
    I'm new to plsql, working on a stored procedure.
    Basically, trying to create a temporary table by using the dynamic sql... Here is my code, the runtime, I'm encoutering error of insufficient privileges. not sure where I'm wrong. any help is appreciated, thanks

    -successfully - compiled code
    SQL > CREATE or REPLACE procedure stp_temp (i_table in varchar2)
    2 is
    3 table_creation_stmt varchar2 (4000): = ";
    4 start
    5
    6 table_creation_stmt: = 'CREATE of TABLE TEMPORARY GLOBAL' | i_table | ' AS select * from TABLE_STGG';
    7 dbms_output.put_line (' query is :'|| table_creation_stmt);
    8 execution immediate table_creation_stmt;
    9 end;
    10.

    Created procedure.

    SQL > exec stp_temp ('table123');
    Request: CREATE TEMPORARY TABLE global table123 AS select * from TABLE_STGG
    BEGIN stp_temp ('table123'); END;

    *
    ERROR on line 1:
    ORA-01031: insufficient privileges
    ORA-06512: at "E3US9T. STP_TEMP', line 8
    ORA-06512: at line 1


    -table gets created to copy/paste on top of the output (that is the query)

    SQL > CREATE GLOBAL TEMPORARY TABLE table123 AS select * from TABLE_STGG;

    Table created.

    Why the hell you create a TWG in a stored procedure?

    Create once and be done with it.

    To answer your question, your create table privilege granted to you via a role. Roles are not in pl/sql, you need the privilege granted to you directly.

  • Question on MERGE in inside a stored procedure?

    Hello people,
    I have this procedure who did a MERGE command inside the procedure and, basically, all this is it inserts all the data from the temporary table when there is no match on the Bill_ID.
    Here, my requirement is on a daily basis than the Bill_ID that can be assigned to a different Event_ID. If for example the Bill_ID has changed his event tomorrow the procedure should update the row with the new Event_ID. But in my procedure this is not kept up-to-date because the Bill_ID has not changed and it is the same thing (coz uses MERGE insert when not matched). How to achieve on a daily basis. What is the cornerstone of the code to do this. Am a bit new to programming and am trying to learn.

    CREATE OR REPLACE PROCEDURE load_fadm_staging_area_test (
      p_data_load_date DATE
    ) IS
      v_start_date   DATE;
      v_end_date     DATE;
    BEGIN
      SELECT NVL (p_data_load_date, SYSDATE) - 7,
             NVL (p_data_load_date, SYSDATE) - 1
      INTO   v_start_date,
             v_end_date
      FROM   DUAL;
     
      MERGE INTO stg_fadm_hri_stage_bill_test b
      USING      (SELECT *
                  FROM   stage_bill
                  WHERE  created_date BETWEEN v_start_date AND v_end_date) a
      ON         (b.bill_id = a.bill_id,)
      WHEN NOT MATCHED THEN
        INSERT     (batch_id,
                    beginning_service_date,
                    bill_id,
                    bill_method,
                    bill_number,
                    bill_received_date,
                    bill_status,
                    bill_type,
                    change_oltp_by,
                    change_oltp_date,
                    client_datafeed_code,
                    client_id,
                    created_date,
                    date_of_incident,
                    date_paid,
                    deleted_oltp_by,
                    deleted_oltp_date,
                    duplicate_bill,
                    ending_service_date,
                    event_case_id,
                    event_id,
                    from_oltp_by,
                    oltp_bill_status,
                    review_status,
                    row_effective_date,
                    row_end_date
                   )
        VALUES     (a.batch_id,
                    a.beginning_service_date,
                    a.bill_id,
                    a.bill_method,
                    a.bill_number,
                    a.bill_received_date,
                    a.bill_status,
                    a.bill_type,
                    a.change_oltp_by,
                    a.change_oltp_date,
                    a.client_datafeed_code,
                    a.client_id,
                    a.created_date,
                    a.date_of_incident,
                    a.date_paid,
                    a.deleted_oltp_by,
                    a.deleted_oltp_date,
                    a.duplicate_bill,
                    a.ending_service_date,
                    a.event_case_id,
                    a.event_id,
                    a.from_oltp_by,
                    a.oltp_bill_status,
                    a.review_status,
                    v_start_date,
                    v_end_date
                   );
    END load_fadm_staging_area_test;
    Published by: user11961230 on January 26, 2011 09:36

    user11961230 wrote:
    Hi John,.
    Sorry for the confusion I think I got your point of NVL. Last question would be, now the Row_Effective_Date and Row_End_Date columns are out in the v_start_date and the v_end_date is to say sysdate-7 and sysdate-1.
    If the procedure is executed on a daily basis, then I want to update these columns Row_Effective_Date, Row_End_Date with the dates of every day. How to get there? How to include this code? Thanks for all the help.

    Just add them to the list updated.

    WHEN MATCHED THEN UPDATE
       SET b.event_id = a.event_id,
           b.row_effective_date = v_start_date,
           b.row_end_date = v_end_date,
       WHERE b.event_id != a.event_id;
    

    If you want to update all the (in other words, each corresponding line), then remove the predicate event_id. If you only want to update those that have changed and then leave it in. You could also update them to stage_bill.create_date by using this field instead of variables.

    John

  • stored procedures, newbie question

    I am at the point with my Web site where I need to think about the optimization of the query and have started looking at stored procedures for the first time.

    1. am I right in thinking the benefit of the execution of stored procedures is that it is a pre-compiled query?

    2. I'm trying to use the query cache as my 'normal' queries go, but is it possible to cache the results of a stored procedure?

    In practice, using 1 & 2 would provide a significant increase in performance.

    Personally, I use it only for large heavy updates or deletions. For example, I have an Oracle package with a bunch of procedures that run when a person completes an order - this process involves many tables, deletions, updates and a relatively simple logic. I think that the ideal candidate for a stored procedure.

    I use CF as an alternative if, for example, I have to repeat a load of complex business logic in a stored procedure that I have already written in a CFC.

    Keep in mind the benefits of a stored procedure - basically precompiled code. Don't forget that if you are using well trained cfqueries with cfqueryparams, execution plan gets compiled to the top in the first round * anyway *, so if you call a stored procedure or run your query really there is no difference.

    And Yes - do not underestimate the additional time it takes for a developer to do everything in the stored procedures rather than ColdFusion, they don't call it rapid development of applications for anything

    Don't forget as well as someone can write a stored procedure to poorly coded as well as they can write a wrong encoded query. At least if the developer has its application in front of him, he can see instantly what he needs of the index and locate errors, you could go years before realizing a person made a mistake inside a stored procedure, as no one can see the code.

    Regarding security Yes - if you really want to limit security then sprocs will do that for you. However in most of the applications I've seen the right developer has the possibility to write a query, as they see fit.

    Once I use stored procedures while I think of it - if you have more than one application that needs to do the same thing: this should * definitely * be a stored procedure.

    Basically, the same rules apply to them as any other aspect of programming; security of the duplication of code, efficiency, ease of maintenance - it's all a matter of their maximum weight and decide what is best.

  • Question packets and stored procedures

    Been working with Oracle for a month now and I have a question about stored procedures/packages. I created 3 stored procedures and a search function to do some work as follows:
    1 load the initial set of data into a table.
    2. turn to day of the preceding table columns by using a specific search function.
    3. put to update a single column with a value based on grouped subsets of the data in the table.

    I divide the latter in separate proceedings to facilitate debugging and validation of each step, but now I want to put them all together and run them sequentially. In my view, there are two ways to do this:
    1. create another stored procedure that will run the three in the right order.
    2 create a package and move all procedures and functions and call each in the right order.

    Don't know which approach is preferable, although I'm leaning towards the first option, any actual experience would be appreciated. Thanks in advance!

    Dave

    How about option 3:

    3 create a package and move all procedures and functions, and then add an additional procedure in the package that calls each in the correct order and call this procedure.

    PS. only this last procedure must be in the package spec. All others must be put into the body (and can remain hidden for the code outside the package).

    Published by: Toon Koppelaars February 26, 2010 21:07

  • Simple question-how to call a stored procedure or function of apex?

    Simple question-how to call a stored procedure or function of apex?
    Thanks advance.
    Doug

    Hi Doug,.
    You can call a procedure or function of apex. It depends on what you want to do with the function or procedure. If you want to retrieve table data in a specific area, you can try something like this-

    The following statement creates the function get_bal on the oe.orders of sample table (PL/SQL is in italics):

    CREATE FUNCTION get_bal (acc_no in NUMBER)
    RETURN NUMBER
    IS acc_bal NUMBER (11.2);
    BEGIN
    SELECT order_total
    IN acc_bal
    Orders
    WHERE customer_id = acc_no;
    Return (acc_bal);
    END;
    /

    The function created in the previous example can be used in a SQL statement. For example:

    SELECT get_bal (165) FROM DUAL;

    GET_BAL (165)
    ------------
    2519

    hope this will help,

    Kind regards

    Pascal M
    http://Tajuddin.whitepagesbd.com

  • stored procedure question

    Hello guys,.

    could someone help me in this matter?

    Write a PL/SQL stored procedure that adds a dvd title at the end of the list of movies to a customer. This procedure should take as parameters in entry the customer_ID and film title_ID as your schema defines.

    I wrote the below procedure. I am a very beginner, I appreciate your help.

    create or replace
    PROCEDURE PROC_MOVIE_TITLE
    (CUST_ID IN VARCHAR2, DVD_ID IN VARCHAR2)
    AS

    BEGIN
    SELECT r.memberid, d.dvdid in CUST_ID, DVD_ID
    R, d dvd RENTAL
    where are.dvdid = d.dvdid;



    END PROC_MOVIE_TITLE;

    Add new column as "dvdtitle" in the table of the rental.
    And follow these steps

    create or replace procedure upd_dvdtitle (p_dvdid number)
    is
    Start
    Update rental r set dvdtitle = (select dvdtitle from dvd d where d.dvdid = p_dvdid)
    where are.dvdid = p_dvdid;
    end;

  • Question from numbers in the stored procedure

    Hi all

    I have a problem to store numbers in oracle 11 g. I need the numbers without decimals and with decimal in my data table, I see this:

    1.1 (OK)

    1.2000000000000002 (instead of 1.2)

    1.3000000000000003 (instead of 1.3)

    1.4000000000000004 (instead of 1.4)

    1.5000000000000004 (instead of 1.5)

    1.6000000000000005 (instead of 1.6)

    1.7000000000000006 (instead of 1.7)

    1.8000000000000007 (instead of 1.8)

    1.9000000000000008 (instead of 1.9)

    2.000000000000001 (instead of 2.0)

    I am using this cfc:

    < procedure = "myDB.myPackage.updateTableA cfstoredproc" datasource = "mySource" > "

    < cfprocparam value = "" #arguments.myNumberValue # "cfsqltype ="cf_SQL_FLOAT">"

    < / cfstoredproc >

    In oracle, I have the myNumberValue parameter as a number data type.

    I try CF_SQL_DECIMAL and cf_SQL_NUMERIC, it does not pass anything.

    What type of sql are used in my stored procedure?

    Thank you

    Johnny

    I would use CF_SQL_DECIMAL, make sure just that you set the SCALE = "" attribute to dictate the number of decimal places to send. "

  • Question about handling apostrophe in the stored procedure parameter

    I was wondering how people have dealt with this problem.  In my process I use the operation to execute stored procedure (sp) to write data to a database, and it is by the way the field values to the sp as parameters.  Works fine when everything is normal but as soon as an apostrophe is added in one of the fields, ka-boom.  It breaks .  So I have been messing around with the means to fight against this problem and did not really come wih an appropriate option.  I know that I can go on the form and write a few RegEx and change the single apostrophe double that would work, but I have to write in several events since the form is sent to someone else and I can't have them seeing "clerk"s"instead of"clerk".  Right now I'm writing an xpath statement that would replace the single apostrophe with a double bed with no luck.  I was wondering if anyone else has had this problem and found an easy solution.  Thank you

    Mike

    Why not use the parameterized query option.

    In this way, your settings are replaced by some? and you don't get messed up with the '

    Your select statement would look like: select * from table where column1 =? and column2 =?

    Then you can map the? s in the process variables.

    Jasmine

  • Basic stored procedure helps - not the return data

    Hi all:

    To be fair, I come from a SQL Server environment and have never written anything for PL/SQL / Oracle before, this is my first attempt, so if nothing is better or more effective, please let me know. The immediate problem I'm having is, I have the following stored procedure, and all I want to do is return the data in the table, so that I can fill my DataSet in code. But when I run the code against this stored procedure, it still don't bring back any data (if I just do a standard "SELECT * FROM lkAllocation", I get the results, so I know data are there and the connection is good). If execution of the procedure in my window in Oracle SQL Developer (call PAYSOL.spallocationselectall ();), my results displays no data as well. What is the problem with this stored procedure?


    create or replace
    PROCEDURE spAllocationSelectAll IS
    Whole AllocationID;
    AllocationName Varchar2 (50);

    BEGIN
    AllocationID: = 0;
    AllocationName: = ";

    SELECT
    AllocationID,
    AllocationName
    IN
    AllocationID,
    AllocationName
    Of
    lkAllocation
    ORDER BY
    AllocationName;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    NULL;
    WHILE OTHERS THEN
    -Consider recording the error and then re-raise
    LIFT;
    END spAllocationSelectAll;

    Well, I'm not really in .net (I would participate in another forum so ;)), but this might be useful?

    Value (Oracle.DataAccess.Types)      System.Data.DbType      OracleDbType
    OracleRefCursor      Object      RefCursor
    

    http://download.Oracle.com/docs/CD/B19306_01/win.102/b14307/featOraCommand.htm#g1025379
    http://download.Oracle.com/docs/CD/B19306_01/win.102/b14307/featOraCommand.htm#g1025072

    Perhaps the [forum Windows and .net | http://forums.oracle.com/forums/category.jspa?categoryID=44] is worth a try as well.

  • How to extract data from the APEX report with stored procedure?

    Hi all

    I am doing a report at the APEX. the user selects two dates and click on the GO button - I have a stored procedure linked to this region of outcome for the stored procedure is called.

    my stored procedure does the following-

    using dates specified (IN) I do question and put data in a table (this painting was created only for this report).

    I want to show all the data that I entered in the table on my APEX report the same procedure call. can I use Ref cursor return? How to do this?

    Currently, I use another button in the APEX that basically retrieves all the data from table. Basically, the user clicks a button to generate the report and then another button for the report. which is not desirable at all :(


    I m using APEX 3.1.2.00.02 and Oracle 10 database.

    pls let me know if you need more clarification of the problem. Thanks in advance.

    Kind regards

    Probashi

    Published by: porobashi on May 19, 2009 14:53

    APEX to base a report out of a function that returns the sql code... Your current code goes against a Ref cursor returns the values...

    See this thread regarding taking a ref cursor and wrapping it in a function to channel out as a 'table' (use a cast to cast tabular function vale)...

    (VERY COOL STUFF HERE!)

    Re: Tyring to dynamically create the SQL statement for a calendar of SQL

    Thank you

    Tony Miller
    Webster, TX

  • Ask about UTL_FILE stored procedure

    Hello

    I tried to do an insert into a table which then triggers a stored procedure to write the data inserted into a text file. However, I have a few questions here in the stored procedure. Thanks for trying to help... [Insert-> table-> Trigger-> stored procedure-> text file]

    -The user will execute this sql

    -insert into tester.test_table values ("ab");

    CREATE TABLE TESTER. TEST_TABLE

    (

    LINECODE VARCHAR2 (2 BYTE)

    )

    -Just for test purpose

    CREATE TABLE TESTER. TEST_REC_TABLE

    (

    LINECODE VARCHAR2 (2 BYTE)

    )

    CREATE OR REPLACE TRIGGER TESTER. TRIGGER_AUDIT

    AFTER INSERT OR UPDATE

    TESTER MARKET. TEST_TABLE REFERENCING OLD AS OLD AGAIN AS NEW

    FOR EACH LINE

    DECLARE

    sLineCode VARCHAR2 (2);

    BEGIN

    sLineCode: = ";

    IF THE UPDATE CAN

    sLineCode: =: NEW. LINECODE;

    TRIGGER_PACKAGE. WRITE_FILE (sLineCode);

    END IF;

    IF THE INSERTION

    sLineCode: =: NEW. LineCode;

    TRIGGER_PACKAGE. WRITE_FILE (sLineCode);

    END IF;

    EXCEPTION

    WHEN other then null;

    END TRIGGER_AUDIT;

    /

    CREATE OR REPLACE PACKAGE BODY TESTER. TRIGGER_PACKAGE

    is

    procedure WRITE_FILE (in_LineCode in varchar2)

    is

    sLineCode varchar2 (2);

    v_FileHandle UTL_FILE. TYPE_DE_FICHIER;

    -a few checks for null input data

    Start

    If ((rtrim (in_LineCode) IS NULL) or (in_LineCode is nothing)) then

    sLineCode: = "XX";

    on the other

    sLineCode: = in_LineCode;          -> PROBLEM HERE?

    end if;

    If (length (sLineCode) > 2) can

    sLineCode: = substr (sLineCode, 1, 2);

    end if;

    Insert into TEST_REC_TABLE (LineCode) values (sLineCode); -Insert data to another table for the test

    RUN IMMEDIATELY 'CREATE OR REPLACE DIRECTORY FILEDIR AS | '''' || 'c:\' || '''';

    v_FileHandle: = UTL_FILE. FOPEN ('FILEDIR', 'Test_Table.txt', 'w'); -write in the text file in C:\Test_Table.txt

    UTL_FILE. Put_line (v_FileHandle, 'insert' | sLineCode |) ' @ ' || TO_CHAR(SYSDATE,'DD-MM-YYYY HH:MI:SS AM'));

    UTL_FILE. FCLOSE (v_FileHandle);

    exception

    When other then null;

    end;

    end TRIGGER_PACKAGE;

    /

    (1) the problem I encountered is that when I run sql INSERT for new data, it can be successfully be inserted in both tables TEST_REC_TABLE and table_test, but just do not write in the text file.

    (2) However, when I simply run the procedure I'll get XX for data entry because it is NULL. These data XX then will be seen in TEST_REC_TABLE in the folder "XX" and Test_Table.txt as "Inserted XX @ 01/10/2014-16:56:06. UTL_FILE wrote to textfile so my guess is that it could be due to my misunderstanding of the logic in the audit input null data. Tried, but I'm still distraught, thanks for reporting the issue.

    > 1) I'm just tests and I'm learning here with insert trigger...

    Good. In this case, it's just a bad choice that you have decided to write to a file of a trigger. Basic Oracle is a good site. They also have examples. Please check that the BASE ORACLE - overview of database triggers.

    (> 2) how do I do next?

    Simply create the object once

    CREATE OR REPLACE DIRECTORY FILEDIR AS

    The path must be a location on your server where oracle is installed.

    (> 3) how do I do next? Use this?

    EXCEPTION

    WHILE OTHERS THEN

    DBMS_OUTPUT. PUT_LINE

    ("ERROR" |) TO_CHAR (SQLCODE) | SQLERRM);

    NULL;

    Do not do something. Just remove the exception handling. Do not handle unknown exceptions. If all you want to manage the purpose of logging RECOVERY to end like that.

    exception

    while others then

    lift;

    And on one of the exceptions management forum, member BluShadow has written a nice article 101 PL/SQL: exception management. It would be an enjoyable read.

  • Procedure stored procedure of Vs

    Hello all;

    I'm getting confused with the stored procedure Vs.

    Please say that is valid?

    Procedure is a PL/SQL code block, it never stored in the database.

    Procedure is a PL/SQL code block, it is named and stored in the database.

    Stored procedure is block of PL/SQL code is named and stored in the database.

    s someone saying the basics of Oracle PL/SQL procedure . Microsoft SQL Server stored procedure notion.


    Thank you all;





    Hello

    I don't know what you mean by "a PL/SQL block that is stored in the database without a name".  All that is stored in the database has a name.  Objects in PL/SQL (procedures, functions, triggers, or packets) may contain blocks without name, but those without name of blocks are not procedures.

    A procedure is in fact a PL/SQL block that is stored in the database with a name.  So is a function.  So is a trigger.

    Etbin has a good point (as usual): it is difficult to give a good answer to questions short and vague without any context.  If you can do your details of more detailed questions, we could have better QA idea of what you want to know.  For example, if you don't understand something that read you in a blog or a book, publish the entire paragraph that contains the part don't understand, as a link or make reference to the work complete you.

  • call a pl/sql stored procedure from a report link

    Hi all:

    I have a report with a link in a column, which you take to another page and passes the values to this page, but also need to link, run a stored procedure before you go to the other page.

    In the Forum, I found a case similar to this one, but none of the examples is clear to me that I'm doing this. It seems that the target of the link must be URL, and also I have to call the stored procedure with a javascript function.

    My questions are:
    -Is the best way to do what I need?
    -How should be the syntax of the link that takes me to another page and run the "procedure".
    -How and where I put the "javascript" function to execute the "stored procedure".


    BDD: Oracle 11 g
    Apex 4.1 version


    Best regards

    Gerard

    Hello

    Change the link to call an apex.submit procedure. (javascript).

    Edit:

    I created a basic example.

    Region 1 (just so that you can see the value ready):

    Select: P27_HIDDEN item_Value
    of the double

    Region 2:

    rownum SELECT id, dbms_random.string ('U', 12) sss
    of the double
    connect by level<=>

    element attributes for ID:

    Target: URL
    URL: javascript:apex.submit ({request: 'NAVIGATE', value: {'P27_HIDDEN': #ID #}});

    (P27_HIDDEN is just a hidden item I created)

    http://Apex.Oracle.com/pls/Apex/f?p=54920:27

    Edit2:

    In your case, then you can only have a page based on conditions request = expression1, expression1: NAVIGATE... then a branch of the page to go to the desired page, also with the same conditions

    Edit3:

    I'm not sure what examples you're talking about, that you provide no link; but you mention calling the stored procedure of javascript, so would probably involve some AJAX, but is not necessary IMO.

  • SQL stored procedure input and output parameters

    Hello Gang,

    My dead end trying to call a stored procedure in SQL Server 2008 with the LV database tool.

    for purposes of experimentation, I've created a small procedure with an input parameter that returns an integer as return value.  It works describing a query, but all attempts at LV produce an error-2147217900 when executing query VI.  I did find examples of that.

    Sending a bunch of parameters to a stored procedure and checking the value of return seems to be pretty common stuff.

    I'll appreciate any help.

    Thank you

    Roger

    Hi Roger,

    There are a few prerequisites which I will list below. If you have not checked these things, so don't hesitate, as your hiccups can be there.

    Prerequisites:

    1. Ensure that you can read from a table in the database to verify that you can access the database (user permissions) and ensure that your login details are correct. Among other things, make sure that the. DSN switches to the correct database. (See the simple example below, SQL Select.vi)
    2. Make sure that your user (if you use SQL authentication) has permissions to run the STORED procedure by running the procedure in SQL Server Management Studio (you seem to have already done this)

    Example by calling a procedure without parameters (attached as SPROC_No_Parameters.vi):

    Example by calling a procedure with parameters (attached as SPROC_Parameters.vi):

    An article on the execution of stored procedures is here:

    http://digital.NI.com/public.nsf/allkb/07FD130746083E0686257300006326C4

    Don't forget to download the example VI since it includes the cases where you want an output parameter of the procedure rather than a table.

    I tested these against two very simple SPROCs and it worked fine (on SQL Server 2005, but 2008 should be the same).  Stored procedures have been:

    CREATE PROCEDURE [dbo]. [GetContacts]

    AS
    BEGIN
    -SET NOCOUNT ON added to avoid additional results sets from
    -interfering with SELECT statements.
    SET NOCOUNT ON;

    -Controls insert for procedure here
    SELECT * FROM Contacts
    END

    and

    CREATE PROCEDURE [dbo]. [MultiplyAges]
    @param1 INT = 1
    AS
    BEGIN
    -SET NOCOUNT ON added to avoid additional results sets from
    -interfering with SELECT statements.
    SET NOCOUNT ON;

    -Controls insert for procedure here
    SELECT (age * @param1) OF Contacts
    END

    I would like to know if these examples work for you or if you have any other questions.  Don't forget to go through this KB article and articles related to it, they should cover other situations.

    Matt

Maybe you are looking for