Write a stored procedure to insert records in a database to a different database


I have two databases A and B and I have to insert some data in the table of A database to the database of B. So I (TWO TABLE NAMES SHOULD BE TABLE1 (A) AND table 2 (B))

PROCEDURE XYZ

BEGIN

INSERT SCHEMA_NAME. TABLE2

SELECT (COLUMN1

COLUMN2,...)                               OF A.TABLE1;

COMMIT;

END XYZ;

BUT I GET ERRORS LIKE TABLE OR VIEW DOES NOT EXIST, BUT IN REALITY THERE ARE.

HERE'S A CODE EXAMPLE

PROCEDURE sp_readrecords ()in_run_iIN NUMBER( )

IS


err_i
NUMBER : = NULL;


err_x  
VARCHAR2 (500) := NULL;

BEGIN

SAVEPOINT read_records ;

INSERT IN OTS_OWN . CSXT_RAIL_PROFILE_FILE

SELECT header_g DE TMS . OTC_RAIL_PROFILE_FILE -TABLE OR VIEW does NOT EXIST

INSERT IN OTS_OWN . CSXT_RAIL_PROFILE_MEASURE

SELECT track_segment_prefix_i

, reference_milepost_i

, location_offset_feet_q

, track_type_c

, rail_left_right_c

, height_wear_q

, ctog_wear_q

, rail_weight_q

, latitude_m

, error_s

, error_x

, last_update_d

DE TMS . OTC_RAIL_PROFILE_MEASUREMENT ;

  1. TMS . PKG_TRUNCATE_OTC . TMS . PKG_TRUNCATE_OTC ;------------ TMS. PKG_TRUNCATE_OTC MUST BE DECLARED

COMMIT;

EXCEPTION

WHEN Others

THEN

err_i: = SQLCODE;

err_x: = SQLERRM;

ROLLBACK TO SAVEPOINT read_records ;

csxp_refresh_tabs . sp_csxt_log

(


in_run_i

, "Error reading
Accounts CSXT_RAIL_PROFILE_OR_MEASURE

, err_i

, err_x

);       

END sp_readrecords ;

WHERE THE MSDS IS A DATABASE AND OTS_OWN IS A DIAGRAM OF DATABASE OF OTC

Hello 8dd...

The problem that you have not given the link of database for the remote table:

INSERT INTO OTS_OWN. CSXT_RAIL_PROFILE_FILE

SELECT header_g TMS. OTC_RAIL_PROFILE_FILE; - TABLE OR VIEW does NOT EXIST

In this case this table looks like because it would be in the local database.

If this table is in a remote database, you must extend this object with the database link.

You can find links to db: SELECT * FROM DBA_DB_LINKS;

After that, you already know what db connection you want to use (there could be several), then you must extend each reference object with this link:

For example:

INSERT INTO OTS_OWN. CSXT_RAIL_PROFILE_FILE

SELECT header_g TMS. OTC_RAIL_PROFILE_FILE@your_db_link; - TABLE OR VIEW does NOT EXIST

I hope it helps.

Kind regards

David

Tags: Database

Similar Questions

  • optimize a stored procedure to insert data

    Hello

    I followed table structures,

    Client:

    ID number pk,

    name varchar2 (100),

    number of autooption);

    CustItem:

    The ItemId number,

    Number of CustomerId

    CustItemAdd:

    (ItemId number,

    Number of assets)

    CustItemAddLog:)

    The ItemId number,

    Number of CustomerId,

    LogDate date,

    autooption)

    I wrote after a stored procedure to load the elements of CustItemAdd to CustItem. My query select fetch 18000000, so finally I insert these many records in

    2Tables, as in stored proc.

    Loading of the required data, it takes about 7 hours to complete. I used addition of suspicion, he worked a little faster in sql directly, but in sp for the two statements,

    It is throwing error that I can't use it in parallel.

    Can I use a way to insert quickly data?

    create or replace procedure SPCUSTITEMNEWSAVE

    (sFlag out varchar2)

    is

    Start

    -Boot flag

    sFlag: = '0';

    --===============================================================

    -Insert new elements to save the table.

    --=================================================================

    INSERT INTO CustItemAddLog

    SELECT

    ca.itemId,

    Cust,

    SYSDATE,

    Cust.autooption

    OF CustItemAdd CA,.

    Customer Cust

    WHERE THERE IS NO

    (SELECT 1 FROM custitem WHERE customer = Cust AND item = ca.itemid)

    )

    AND cust.autooption in (1,2)

    AND (ca.active = 0

    GOLD ca.active IS NULL);

    --===============================================================

    -Insert new elements.

    --===============================================================

    INSERT INTO CustItem

    (

    Customer,

    Agenda

    )

    SELECT

    Cust,

    CA. Item,

    100

    OF CustItemAdd CA,.

    Customer Cust

    WHERE THERE IS NO

    (SELECT 1 FROM custitem WHERE customer = Cust AND item = ca.itemid)

    )

    AND cust.autooption in (1,2)

    AND (ca.active = 0

    GOLD ca.active IS NULL);

    --===============================================================

    -Remove the downloaded items.

    --===============================================================

    DELETE CustItemAdd

    WHERE THERE ARE

    (SELECT point above CustItem WHERE, .itemid = CustItemAdd.itemid

    );

    COMMIT;

    sFlag: = '100';

    --================================================================

    -Exception handling

    --================================================================

    EXCEPTION

    WHILE OTHERS THEN

    sFlag: = '300'-| SQLERRM;

    ROLLBACK;

    end;

    Little does not return the error code in a parameter out. Next EXCEPTION WHILE OTHERS without STIMULUS is completely false. Never do this.

    Now in regards to performance try using the INSERT all statement.

    create or replace procedure spcustitemnewsave
    is
    Start
    Insert / * + APPEND * /.
    all the
    in custitemaddlog
    (
    ItemId
    CustomerId
    LogDate
    autooption
    )
    values)
    ItemId
    id
    dt
    autooption
    )
    in custitem
    (
    customer
    element
    )
    values)
    ID
    element
    )
    Select ca.itemid
    Cust
    sysdate dt


    cust.autooption
    from custitemadd ca
    customer cust
    where there is no
    (
    Select 1
    of custitem
    where customer = Cust
    and item = ca.itemid
    )
    and cust.autooption in (1,2)
    and)
    CA.active = 0 or
    CA.active is null
    );

    delete custitemadd
    where there are
    (
    Select the item
    the custitem this
    where ci.itemid = custitemadd.itemid
    );

    commit;
    end;

  • How to run a stored procedure by using the steps in database?

    Hello

    I'm trying to run some procedures of the store and it will not work.

    See the file attached is seq.

    I have a varchar parameter (50), which must also be provided to the stored procedure and it returns an int.

    To do this I had to only use data in an open statement

  • Inserting record in the database and then display on the next Page

    Hello!

    For a while since I posted here, but I've been pulling my hair out on this one.  Here's what I want to do.  I have a page that I want to be able to enter text in two form fields, then click on "Insert disc", and then on the next page, I just submit display.  For example, on the "insert.php" page I want to enter the field ID and Joe 43569 in the first name field.  Then after I click on submit (or insert record) the next page will have a text that says: "congratulations Joe, your ID is 43569.»  Have a great day! "Or something to that effect.

    I have the database mySQL, set up and insert records into it since this page works correctly.  Here is the code of my insert.php page which I think is the issue.   I'm just confused as to which should be added to the page detail.php to have this sentence appears correctly.  Is there something that should be added to the code on the page insert.php?  Something after the detail.php on that first line?

    Thank you, thank you, thank you in advance.

    Brent

    $insertGoTo = 'detail.php ';
    If (isset {}
    $insertGoTo. = (strpos ($insertGoTo, '?'))? « & » : « ? » ;
    $insertGoTo. = $_SERVER ['QUERY_STRING'];
    }
    header (sprintf ("location: %s", $insertGoTo));
    }
    ? > <! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional / / IN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" > ""
    " < html xmlns =" http://www.w3.org/1999/xhtml ">
    < head >
    < meta http-equiv = "Content-Type" content = text/html"; Charset = UTF-8 "/ >"
    < title > Untitled Document < /title >
    < / head >

    < body >
    < do action = "<?" PHP echo $editFormAction;? ">" method = "post" name = "form1" id = "form1" >
    < table align = "center" >
    < tr valign = 'of basic">
    < td nowrap = "nowrap" align = "right" > ID: < table >
    < td > < input type = "text" name = "ID" value = "" size = "32" / > < table > "
    < /tr >
    < tr valign = 'of basic">
    < td nowrap = "nowrap" align = "right" > first name: < table >
    < td > < input type = "text" name = "lastName" value = "" size = "32" / > < table > "
    < /tr >
    < tr valign = 'of basic">
    < td nowrap = "nowrap" align = "right" > < table >
    < td > < input type = "submit" value = "Insert file" / > < table >
    < /tr >
    < /table >
    < input type = "hidden" name = "MM_insert" value = "form1" / >

    < / make >

    When you submit the form, the form fields values are passed to the query insert as variables of $_POST, but as soon as you redirect the user to another page, these variables are destroyed.

    There are two ways to preserve the values: use sessions and session variables, or add values to the end of the redirect URL query string. Using the variables of session is probably easier since you can do it at the top of the page that inserts data into the database without affecting the code of Dreamweaver Server behavior.

    Put this at the top of the current page:

    
    

    In details.php, add top of the page. You can then use $_SESSION ['ID'] and $_SESSION ['name'] to display the values.

  • Problem to INSERT INTO using the stored procedure in 10g

    I use a 10g R2 database.

    I created two tables as follows:
    SQL > create table t1 (c1 varchar2 (1), number (1) c2, c3 number (1);)
    SQL > create table t2 (deptid varchar2 (4), empid varchar (4), varchar2 (1) c1, c2 number (1) c3 number (1);)

    insert into t1 values ('A', 3, 5);
    insert into t1 values ('B', 5, 5);
    insert into t1 values ('C', 5, 5);

    I want to create a stored procedure to insert data into table t1 t2 and certain parameters of the procedure.
    Is this possible?
    As an example:
    SQL > execute test (1,2)

    This procedure will be insert these two parameters in table t2 AND select rows in table t1 and insert into table t2 at the same time.
    How can I write the procedure?
    Tip:
    SQL > create or replace procedure
    (v_deptid, v_empid number)
    is
    BEGIN
    Insert into t2 (deptid, empid, c1, c2, c3)
    ... Select c1, c2, c3 from t1;
    end;

    My question is: How can I insert the v_deptid and v_empid parameters at the same time?

    Try

    SQL > create or replace procedure
    (v_deptid, v_empid number)
    is
    BEGIN
    Insert into t2 (deptid, empid, c1, c2, c3)
    Select v_deptid, v_empid, c1, c2, c3 to t1;
    end;

  • stored procedure - insert clob obj - msg error: ORA-01460: unimplemented

    Hi all

    I have a situation where I want to insert an object, clob to my local table using a stored procedure. The clob object stores the large amount of text. The clob data are met to retrieve the content in an external text file. When you run an insert statement in the c# code, the information was inserted successfully. When you run the stored procedure to insert the information, I always "ORA-01460: letter dead or unreasonable conversion requested". I use the StreamReader class ReadToEnd() to extract the context of the external text file. Does anyone know why Oracle is behaving in this way? Thanks for help in advance.



    TABLE DEFINITION FOR CLOB_TEST
    Name       Type         Nullable Default Comments 
    ---------- ------------ -------- ------- -------- 
    PKG_NAME   VARCHAR2(50) Y                         
    PKG_DESC   CLOB         Y                         
    PKG_FAM_ID NUMBER       Y                         
    STORED PROCEDURE
    procedure InsertTempReleaseTable(p_name        in varchar2,
                                       p_description in clob,
                                       p_fam_id      number) is
      begin
        insert into clob_test
          (pkg_name, pkg_desc, pkg_fam_id)
        values
          (p_name, p_description, p_fam_id);
      end InsertTempReleaseTable;
    EXTRACT THE CONTENTS OF A TEXT FILE
    public string GetTextFileContents(string path)
            {
                using (StreamReader sr = new StreamReader(path))
                {                
                      return (sr.ReadToEnd());
                }
            }
    C# CALL THE INSERT STORED PROCEDURE
    using (OracleCommand cmd = (OracleCommand)database.GetStoredProcCommand("pkg_sptbuildstatus.InsertTempReleaseTable"))
                {
                    cmd.Parameters.Add("p_name", OracleType.VarChar, 255).Value = obj.PackageName;  // string   
                    cmd.Parameters.Add("p_description", OracleType.Clob).Value = obj.ChangeDescription; // string
                    cmd.Parameters.Add("p_fam_id", OracleType.Number).Value = obj.FamilyId; // int
    
                    database.ExecuteNonQuery(cmd);
                }
    Published by: user8976335 on January 11, 2010 16:28

    Published by: user8976335 on January 11, 2010 16:59

    Published by: user8976335 on January 11, 2010 16:59

    Published by: user8976335 on January 12, 2010 10:48

    Well, that may (or may not) be useful to you.

    Can you test your routine with CLOB less than 32K in size (and see if this attempt is successful)?

    IF Yes, then it is possible, that's your problem...

    [http://asktom.oracle.com/pls/asktom/f?p=100:11:0:P11_QUESTION_ID:122012348063]

    "
    they are so NOT to cross a clob, they pass a string.

    In Java or ProC or OIC you can create a clob customer, fill it and pass it.

    My guess is that they use a string and a string is not a clob and a string will be limited
    for 32 k as a variable binding, or 4000 bytes as a literal in a sql statement.
    "

  • Appellant DB stored procedures before committing changes.

    Hello

    I use JDeveloper 11.1.1.6.0.

    I have a use case that requires me to do the following:

    When you create a new transaction in master-detail, I have to call a stored procedure that selects the transaction full master/detail and insert it into a table to archive. To resolve this problem, I have substituted the beforeCommit method in the implementation of AM class and call the stored procedure from the pharmacokinetics of the current line in my header VO. I found this solution after reading [http://www.oracle.com/technetwork/developer-tools/jdev/index-092937.html] written by Steve Meunch. More specifically the following, that I needed the whole transaction in the database before calling the stored procedure.

    + POST-FORMULAIRES-COMMIT

    Run the code after the "posted" all the lines necessary for the database, but before issuing the VALIDATION data at the end of the transaction. If you want a single block of code for the entire transaction, you can override the doCommit() method in a custom DBTransactionImpl object and write code before calling super. To run the code specific to the entity before validation for each entity affected under the operation, override the method beforeCommit() on your entity object and write the code it. +

    The second part of the use case allows a deletion on the header only. This action should also call the stored procedure and insert the transaction full master/detail in the table of archive. To do this, my previous solution does not work. The current line is not the line that has been deleted. In the article referenced above, I assumed that the following could offer me the solution,

    + PRE DELETE

    Run the code before the line removed the datablock is REMOVED from the database during the processing of "post". Method doDML() override in your entity class and if the operation is equal to DML_DELETE, then write the code before you call the super. +

    Actually it works, but the overridden beforeCommit also runs, so I have the deleted record and the next record in the VO inserted in my table of archives.

    I tried a few options by exposing the method that calls that the stored procedure for my UI project, but it has also some problems, as my PK is filled with DBSequences and at the point of my workflow when I run the sequence method is not yet filled.

    Ideally, I'd like that some entries in how I might solve this problem to my business services layer.

    Concerning

    Leon.

    To be honest I would always fix this to the database layer, copy the following code is negligible in the PLSQL triggers, why clutter up the average level by additional detours?

    CM.

  • Problem with stored procedure and validation

    I have the following stored procedure:

    create or replace PROCEDURE SOME_PROC)

    /*

    Some settings

    */

    ) AS

    NUMBER of errors

    BEGIN

    errors: = FN_CHECK_BUSINESS_RULE_1 (/ * some args * /);

    if(Errors > 0) then

    raise_application_error (ERR_CONSTANTS. SOME_ERROR_NUMBER, ERR_CONSTANTS. SOME_ERROR_MESSAGE);

    end if;

    INSERT INTO une_table (/ * columns * /) VALUES (/ * values * /);

    END SOME_PROC;

    Because the business rule 1 is placed inside the stored procedure I can't check it out without calling the stored procedure.

    I need to call the stored procedure 10 times with a different set of parameters and validation of the changes only after all calls to the stored procedure

    are successful. I want to show the user all the errors that occurred during the stored procedure calls. If for a first example of stored procedure call

    succeeds and a second failure no data has to be stored in a database.

    How to prevent the stored procedure for insert lines until I call the method commit of ApplicationModule?

    Thanks in advance.

    No, other users only see the lines until you commit. The search term is the transaction isolation level. Tom Kite write a paper on this here ask Tom: on transaction isolation levels. This article gives some samples, according to theory, and you should read it.

    Timo

  • Transaction in stored procedure not treated as Atomic?

    Hello

    I have a stored procedure that inserts a line in a table called reservations and also decrement the places available for an event.

    For example: at an event, there are 100 places available. After you add a reservation, it will be left only 99 seats.

    I also have a Java program that sends 100 concurrent transactions to the database.

    After 100 transactions, there are 100 reservations, but there are still about 60 free places.

    So, I guess that the transaction he has not treated as atomic. I don't know why some transactions fail?

    The code of the stored procedure:

    create or replace PROCEDURE procedureOne (s_price, NUMBER, NUMBER, of s_customer)

    s_event NUMBER, DATE, s_movie NUMBER of s_dat)

    IS

    s_ev NUMBER;

    s_free NUMBER: = 0;

    BEGIN

    commit;

    Set transaction read write;

    Start

    SET TRANSACTION ISOLATION LEVEL READ COMMITTED;

    Select Event_ID, Free_seats EN s_ev, s_free

    events

    where ID_Movie = s_movie;

    If s_free > 0 then

    Start

    update events set Free_seats = s_free-1;

    insert into values of reservations (seqa_seq. NEXTVAL, s_dat, s_customer, s_event, s_price);

    commit;

    end;

    on the other

    Start

    Rollback;

    end;

    end if;

    end;

    commit;

    end procedureOne;

    invatacelul wrote:

    So, I guess that the transaction he has not treated as atomic. I don't know why some transactions fail?

    You said: "I also have a Java program that sends 100 concurrent transactions to the database. Atomicity applies to a single transaction - it says transaction executes all or nothing. Is what you run in isolation. If you want isolation unless you serialize, transaction 2 sees no uncommitted transaction 1 results because the READ COMMITTED isolation level indicates that a transaction can read only the data that has been committed to the database. And since you wrote your code as SELECT + UPDATE you get results you never expected. Use:

    UPDATE OF EVENTS

    SET FREE_SEATS = FREE_SEATS - 1

    WHERE ID_Movie = s_movie

    AND FREE_SEATS > 0;

    SY.

  • Execution of the stored procedure Oracle EF6 error.

    Hello

    Need help with the oracle error

    {"ORA-06550: line 1, column 8:"}

    PLS-00306: wrong number or types of arguments in the call to "sp_name".

    ORA-06550: line 1, column 8:

    {"PL/SQL: statement ignored '}

    This error occurs when the code runs the line in Vb.net application in Model Designer

    MyBase.ExecuteFunction ("sp_name" para1, para2, para3, dOBpara4, para5)

    I create the SSDL and CSDL, MSL files for oracle to MS SQL connection by the method mentioned in the link JasonShort - professional profile - CodeProject it worked perfectly fine without the stored procedures. I managed to insert, update, and delete records. Then, I created stored procedures for Insert, Update, Delete. It worked fine with MS SQL. I copied and updated oracle files respectively. I gives me the error mentioned above.

    I executed stored procedures in Oracle SQL Developer, and it works without error. But when it is executed via the model there is light of the error. Can anyone let me know the solution for this error. I'm using VS2010, EF6, Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64 bit Production

    Thank you

    Prachin Soparkar

    Hello

    Sorry for the inconvenience. After I posted this question I took a break and saw that the error was nothing, but I had given FNAME as parameter name in MS SQL. In oracle when I created the sp I created the parameter with p_FNAME. Where the schema defined in the language SSDL and CSDL, MSL had to be changed to MS, but since I want to that it would be same in different databases, I choose to have changed it in oracle stored procedure. The error msg is confusing, it should be something not found parameter or incompatibility etc.

    Thank you

    Prachin Soparkar

  • PL SQL Stored Procedure help

    Hello
    I'm new to the development of Oracle.
    I have the following scenario for which I need your help/suggestions to write a stored procedure.
    A load process in a table unfolds with about million files once a month.
    I have a LOG Table to record the events of job loading IE when it starts, when it stops, status etc. with the following columns

    job_name, job_status, start_time, end_time, date, flag

    work focuses on the work that is in charge of the table.
    Based on the values in this table, I want to develop a stored procedure sql pl verifies the status of the job and does the following

    When the flag = R (assume for running job) set it to run the job again as 1 hour later... if its still ongoing then 1 hour later... so now up to 5 trys
    = F (Finished)
    = E (error problem) launch the load immediately

    The flag State values noted above are not binding... values just to give you an idea... all the other variables to use to store procedure or any new passes in the table... .suggestions are welcome for these values as well.
    Basically, I would like the stored procedure to be called at some point... say SUNDAY at 06:00 and check the STATUS of the INDICATOR/table newspaper column and run.

    In short, I like the pl sql store procedure to use table to log and monitor the loading process.

    Structure/Basic code stored procedure for this requirement or a stored procedure that you have met similar requirements are welcome.

    Thanks in advance.

    Published by: user13517642 on March 23, 2011 13:28

    Published by: user13517642 on March 23, 2011 13:29

    Your process or procedure shud look like - [not tested]

    DECLARE
       l_flag   LOG.flag%TYPE;
    BEGIN
    
          SELECT flag
            INTO l_flag
            FROM LOG
           WHERE job_name = p_job_name;
    
       WHILE l_flag = 'R'
       LOOP
          DBMS_LOCK.sleep (3600);   --3600secs in 1hr
    
          SELECT flag
            INTO l_flag
            FROM LOG
           WHERE job_name = p_job_name;
       END LOOP;
    
       IF (l_flag IN ('F', 'E'))
       THEN
            --<>
       END IF;
    END;
    

    Look at the following to find out how to plan work-

    http://www.oradev.com/dbms_scheduler.jsp

    Published by: Sri on 23 March 2011 14:10

    Published by: Sri on 23 March 2011 14:11

  • Temporary tables in stored procedure

    Hello

    I write a stored procedure that will get data from different sources and generates a spreadsheet finally. Initial selection gets the basic data and chooses then merges the data.

    To do this, I created a table in the database, I'm filling in data in this table by using the same procedure and finally selection of data in this table to generate the worksheet.

    Now, I plan to use the TEMPORARY table instead of create database table. Can someone tell me where I can watch examples for temporary tables?

    What is the best option in performance wise?

    or

    I can handle the whole scenario with slider? examples?

    Hello

    Why you cannot use an ordinary table?

    Search for [Global Temporary | http://download.oracle.com/docs/cd/B28359_01/server.111/b28286/statements_7002.htm#sthref7247] in the diocumentation, including SQL * manual language, an alternative.

    'Temporary' applies only to the data. A global temporary Table is created once and remains until you DROP, the same as any other table.
    The data in the table are temporary. If you create the table by saying "ON COMMIT PRESERVE ROWS" (which seems appropriate, according to your description) the data will be automatically deleted when you end the session database.

    All global data in temporary Tables are specific to the session. If two (or more) people use the same table at the same time, each one will see data that they inserted themselves; they'll never see rows inserted by the other session.

    Almost everything you can do with an ordinary table, you can do with a global temporary Table. In particular, DML (such as FUSION) and cursors work exactly as they do on other tables.

  • 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.

  • debug a stored procedure

    Hi all
    I'm kinda new to odp.net and I was wondering is there a way to get into a stored procedure that is already on the database

    so for example of oracle 10g using Toad, I did the following.
    create table emp as 
    (select 'Bob' name, 100 sal from dual union
     select 'Fred' name, 200 sal from dual union
     select 'Mary' name, 300 sal from dual union
     select 'Joe' name, 400 sal from dual 
     );
    then I did a stored procedure
     CREATE OR REPLACE procedure p_Increment_Salary is
     Begin 
        Update emp set sal = sal + 600;
        commit;
     end;
    I am running Oracle 10 g Release 10.2.0.1.0
    I have Oracle Developer Tools for Visual Studio Copyright (c) 2005, 2007
    and I'm under visual studio 2008 version 9.0.21022.8RTM version 3.5 SP1

    in visual studio, I did a project asp.net with a button and I click on the button
    Protected Sub btnExecuteDML_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnExecuteDML.Click
            'Create Connection to Database
            Dim cn As New OracleConnection("Data Source =xxxxx; User Id = xxxxx; password = xxxxxx")
    
          
            ' create the command object 
            Dim cmd As New OracleCommand
            With cmd
                'specify thay you are working with a sotred procedure
                .CommandType = CommandType.StoredProcedure
                'provide the name of the stored procedure
                .CommandText = "p_Increment_Salary"
                'proceed with the execution
                .Connection = cn
                .Connection.Open()
                .ExecuteNonQuery()
                .Connection.Close()
                .Dispose()
            End With
            Response.Write("<script>alert('Succesfully executed')</script>")
        End Sub
    End Class
    I set a breakpoint before the ExecuteNonQuery method and I would like to know how to enter in the stored procedure, but I can not quite understand.
    I opened Explorer server and sailed towards my stored procedure and it allowed set breakpoints inside but they get ignored when I run the web page in the debugger.


    Thank you.

    Hello

    You'll need to set up and activate the PLSQL debugger in the Oracle Developer Tools for Visual Studio. Here is a small tutorial and how to guides you though the process.

    http://www.Oracle.com/technology/oramag/Oracle/06-Sep/o56odp.html

    There is a forum for issues specific to the developer tools to:

    Oracle Developer Tools for Visual Studio

    HTH
    J.B.

  • simple stored procedure

    Hello

    I'm new to stored procedures. I am trying to write a stored procedure that returns only the result of a statement select.

    I wrote the below without compilation error:
    create or replace procedure test_select
    (number, x y out varchar2) is
    Start
    Select isbn in x from books where isbn = y;
    end test_select;
    /

    When I call the procedure, I get an error:
    SQL > call the test_select (2);
    call the test_select (2)
    *
    ERROR on line 1:
    ORA-06553: PLS-306: wrong number or types of arguments in the call to 'TEST_SELECT '.

    Here is a description of the table 'books ':
    TITLE VARCHAR2 (60)
    AUTHOR VARCHAR2 (60)
    ISBN NOT NULL NUMBER (10)
    PUB_DATE DATE

    Thanks in advance,
    Justine.

    Hi Justine,.

    you stated a procedure with two parameters and you call it from a single (no matter that the second is RELEASED, you must pass it as well)

    The simplest approach would be to use a function instead:

    create or replace function test_select (number of y) return varchar2 is
    x varchar2 (20);
    Start
    Select isbn in x from books where isbn = y;
    Return x;
    end test_select;

    and try out it:
    Select test_select (2) double

Maybe you are looking for

  • New private window opens in pop up windows

    -Navigation in a private window-Parameters are set on... Open the link in a new window (which should be a new private browsing window)-I click on the link on a site-New private window opens the link in a pop-up window with no bar to scroll/bar menu/b

  • Help! Vista product key?

  • P2V - System Center Virtual Machine Manager 2008 R2

    I am running Microsoft System Center Virtual Machine Manager 2008 R2 on a Windows Server 2008 R2 with SP1 enviornment. I am creating a P2V Conversion in the P2V Assistant and 'Conversion of information' section, I get the following error message: Err

  • Computer crashes and sometimes won't start

    I have a computer that is running Windows Vista Home Premium (64-bit (I think) and there has been expriencing problems. (don't even tell me off the coast for the wrong spelling, I couldn't spell if my life depended on it!) It's a lot of old (about 20

  • How to get ClearType to work better?

    I bought a big monitor and now small fonts are blurry as in the address bar in Explorer or words in the Solution Explorer tabs.  I had this problem with my smaller monitor. I bought an ASUS VS247H-P 24-inch LCD monitor and an NVIDIA graphics card upg