Understanding stored procedures

Hello

Oracle 11.2.0.0.2

I am trying to learn how stored procedures to use them later in the future web applications.  I was going through some documentation and found a simple stored procedure and I just wanted to see if someone could help to clarify if I understand how this stored procedure is supposed to work.

TRIGGER XXX_TEST CREATE create a trigger with the name of XXX_TEST

BEFORE INSERT Execute the trigger before it runs the command INSERT

ON f.w5 FOR EACH ROW, do something "for each line' which is 'on' the table w5 belonged f schema

START the starting point of the orders which will take place within this block

Select count (1) IN the rt of 1934_e.doc where: new. U0 = docnum and 'AA' = a1 and a2 = 'DR' and a3! = « Z »)) ; Select all the records and put new 'in' the variable doc table belonging to f, where rt. U0 variable equals the docnum and column a1 is equal to 'AA' and column a2 is equal to 'DR' and a3 is not equal to 'Z'

IF rt > 0 THEN conditional statement, if the rt variable is greater than 0, then below that

: new.pt: = 9 | substr (PT 2);  concatenation of the variable which is set to match the 9

: new. U1: = 'UNFAIR ';  sets the variable: new. U1: equal to 'EVIL'

END IF;  end of the conditional statement

delete from f.w5 where substr (pt, 1, 1) = 9 and U1 = "UNFAIR."  delete records from table w5 belonged to f where substring value 9 starting at position 1 with a length of 1 is equal to 9 and U1 is equal to 'FALSE'

END;  the point of arrival of the "BEGIN"

The part that I'm not sure of is the IF / END IF block.  I read that the | means the concatenation, but I don't really know what or why it is concatenation.  Another explanation is appreciated!  Thank you.

Hello

You have understood about correctly.

There are many errors in this code.  For example, he referred to the local variables, rt and pt, but these variables are not defined anywhere.  For example, in the assignment you intrigued plus:

: new.pt: = 9 | substr (PT 2);

: NEW.pt initially made reference (rightly) of a column in the current insertion, but pt near the end line (without: NEW.) reference a local variable and I do not see where all the local variables are currently reported.  Perhaps the one who wrote this means use; NEW.pt in both places.

SUBSTR (pt, 2)

means the part of string pt starting with his 2nd character, so

'9' || SUBSTR (pt, 2)

a copy of the pt, but with its first character replaced by "9".

Why the trigger would do this?  Your guess is as good as mine.  Apparently, the pt of the column is a kind of code, and the first character of the code is supposed to be "9" If there is no line in the table corresponding to the column of u0, doc and met certain other conditions, at the point where this line was inserted.

(The | operator expected strings before and after it.)  If you use a NUMBER, such as 9, in a place where one expects a string, such as '9', Oracle will automatically convert the NUMBER to a string, but it is advisable to use the correct data in type.)

Moreover, another error in this trigger is that he tries to DELETE rows from the same table that is based on.  A FOR EACH ROW trigger on tble f.w5 can't even read other f.w5 lines, let alone delete them.

Tags: Database

Similar Questions

  • transaction isolation stored procedure-level testing

    Hello

    I want to study the concurrency in the Oracle database using stored procedures in pl/sql with different transaction isolation levels.

    The idea is to send to the database of a number "n" of simultaneous transactions where n can be {100, 200, 400, 1000} and for each isolation level (READ COMMITTED, SERIALIZABLE) to determine the number of transactions committed, how much data, run time incorrect.

    The question is how can I generate n transactions that run simultaneously on the data base and how to get these results. I understand that this task can be done as well by using pl/sql stored procedure in the database or inside a JSP Java web application. Advantages/disadvantages?

    I should mention that I'm a begginner in Oracle...

    Thank you in advance.

    You want to run a large number of asynchronous (parallel) transactions.

    Although this can be done by running the Oracle's work, I think it is easier to work with the client side, using a Java program (for example).

    It doesn't have to be a web application (for example. JSP), can be a client Java that uses Java threads, and each thread is using a single database connection (and the corresponding database session).

    Kind regards

    Zlatko

  • How to use stored procedures of database instead of triggers in database?

    Hi gurus

    Here in SQL / PLSQL community discussion, I read some discussions that the stored procedures of database are better and 9should be used instead of database triggers.

    But despite reading 10s of discussions, I am unable to understand how a stored procedure may be an alternative to a DB-trigger while having many differences.

    And even if I'm using a DB instead of DB-trigger procedure, then at what level I should call? of my application, oracle forms IE?

    And should I write 3 different procedures, each of them for the Insert, update and delete while I can manage all of these events from a single trigger?

    Will you please advice me for this because I am using widely especially triggers to maintain the Stock / inventory, update several tables of a trigger n etc.

    PS... I'm working on the database 10g Rel.2.

    I use extensively since Oracle 7 database triggers (database Oracle 6 had no triggers).

    I use it mainly for complex integrity checks and sometimes for the calculation of derived data.

    So, I do not accept that "database triggers are evil".

    It is often said that, instead of triggers in database, we use the API (API function, better than the table API).

    However, the API may not always replace triggers.

    Excellent explanation is given by Toon Koppelaars in 'triggers considered harmful, considered harmful' http://harmfultriggers.blogspot.com/

    Regarding your question, it is possible to make the procedures of database to work with Forms - Yes, it is possible.

    You can make the database to INSERT, UPDATE, and DELETE procedures and call them before or / and after INSERT / UPDATE / DELETE triggers of forms.

    Another option is to use on INSERT / UPDATE / DELETE triggers of forms.

    Please note that I do not use these forms to work with the Oracle database triggers. In my view, database triggers are much better.

    The third variant will create a data block in a procedure that uses a "table of records.

    Kind regards

    Zlatko

  • ODP 12 c version 3 with EF 6.1.1 I can't add Stored Procedure of a package to my model

    I use the ODP 12 c Release 3 (12.1.0.2.1), with Entity Framework 6.1.1 with the first database in MS Visual Studio 2013 update 4

    I have a MVC 5 (.Net Framework 4.5.2) project that connects to Oracle 11 G R2 Database server, an existing database (Tables, views and a pack of Stored procedures)

    I can add tables and use them successfully in my model
    I can add a simple stored procedure

    Here's the problem:
    I have my .edmx file right click and click on "update model from database...". «, on the 'Add' tab, I chose «Stored procedures and functions»
    I can see the list of procedures stored in the package (format packageName.usp) and check the box for the stored procedure of my package, then click 'Finish' to start the update process.

    No stored procedures have been added to my Model.Store


    The only possible exit I get the 'entity data model' is:
    Generated template file: Model1.edmx.
    Loading metadata from the database took 00:00:00.5803351.
    The model generation took 00:00:00.3761861.

    How to add a stored procedure from a package with the Entity Framework 6.1.1?

    I found the answer.

    When in the edmx model and you right click "Update Model database.

    Uncheck "Import selected stored procedures and functions in the entity model", select the package and update procedures. (It works)

    Then in "Model Explorer" under "Model. Store\ stored procedures/functions" you will see your procedures in the package (finally). Then their card in "Function Imports".

    I don't understand why unchecking import stored procedures works, but it does.

    I also found easier to simply call the procedure directly and not using Entity Framework, as all my procedures are: insertion, update and deletions and not all parameters mapped on the model for the view.

  • Creation of XML report using the PL/SQL stored procedure

    Hi friends,

    I'm working on a report xml with the xml source as a PL/SQL stored procedure.

    I mean the fiscal year indicated in the following link to understand the process:

    http://orclapp.blogspot.com/2012/02/developing-xml-publisher-report-using.html

    In the example shown in the link above, I did not understand the following:

    (1) in the following procedure, setting out "retcode" is not used at all.

    What is the importance of this parameter.

    REPORT PROCEDURE (errbuf OUT VARCHAR2, retcode OUT VARCHAR2, p_product_id in NUMBERS)

    (2) after the xml data are prepared and updates 'l_result' variable Clob, what follows

    Loop is executed. I am not able to understand why the following loop is required.

    LOOP

    EXIT WHEN l_length = l_retrieved;

    IF (l_length - l_retrieved) < 32000

    THEN

    SELECT SUBSTR (l_result, l_retrieved + 1) IN l_xmlstr FROM DUAL;

    l_retrieved: = l_length;

    fnd_file.put_line (fnd_file.output, l_xmlstr);

    ON THE OTHER

    SELECT SUBSTR (l_result, l_retrieved + 1, l_offset)

    IN l_xmlstr

    FROM DUAL;

    l_retrieved: = l_retrieved + l_offset.

    fnd_file.put_line (fnd_file.output, l_xmlstr);

    END IF;

    END LOOP;

    (3) in the example it is not explained how the concurrent program gets the xml data?

    I guess that it is written to a file by using the following line of code:

    fnd_file.put_line (fnd_file.output, l_xmlstr);

    I would be grateful if someone can shed some light in my questions above so that I can well understand the process.

    Thanks and greetings

    Hawker

    Hi 32000 in the code is a 'safe' than 32767 available max mesh, loops is intended to get around the entire thing into pieces that can be managed within the limits of the data type.

    BTW; If you are in the following Oracle e-business, you can also use the Oracle reports very simply to create the XML output.

    If you have reports developer all you need to do is put raw sql (create XML without any "Fireworks") in the SQL report and then set reporting in XML format in the definition of program in Oracle e-business.

    Best regards

    Robert.

  • status of stored procedures

    Hi all

    Recently, our production database has been moved from DB2 to Oracle.

    I want to optimize DB

    I want to know, are at - it stored procedures, as performance impact. ?

    Thanks in advance

    Jr.Raj wrote:

    Thanks to you all

    import/export using sql loader, was done.

    I want to record/document the consequences, what sqls are affected. How can I do this

    IE is it possible trace/find the consequences.

    its easy to fix the database for me as soon as I know the implications.

    Thanks in advance

    SQL Loader to load data from Oracle

    Export/import (if you really mean the Oracle exp/imp orders) would be used to export and import from a database to a different Oracle database Oracle, if you say it's on DB2, so I don't know how you did that.

    Your question is always crazy.

    We do not know how you took procedures of DB2 and converted to procedures on Oracle.

    As Frank says, there will certainly be performance factors, so you can just take the code of a database, write the same code on Oracle in the same style and expect it to work as well.   The correct way to migrate the code must understand what each unit of code is supposed to do (entered accept, what exit that generate, what he does on the basis of data etc.) and write from scratch in Oracle uses the best features of Oracle for this.

    In regard to the performance of SQL queries, if database tables were well designed for their use (i.e. properly normalized (assuming that it is not an OLAP database)) and appropriate indexes exist for queries that will be made against it and statistical database etc are collected then Oracle will choose the best path of execution by SQL executed against them.

    So is your question about the performance of SQL queries on the database tables or code PL procedure/functions that were converted from DB2 to Oracle; and if the latter, then it would need to know which deal with these procedures/functions through to become Oracle'ized, and what looks like him code PL (i.e. don't talk about code that has loads of nested loops cursor rather than the SQL instructions pure; or code that did a lot of "off-database" calcuations or other).

    There is no way that anyone can just give you a list of the "impact", and how you say it is easy to set up the database once you know the implications is somewhat flippant.

  • How to do this consult of a hierarchical recursion on a stored procedure? Help!

    Please help me, im using oracle 11g

    I have 2 tables

    Department table (number of I_Depto (1), number of E_Depto (30));

    i_depto e_dept

    1 Finance

    2 shopping

    3 sistemas

    4               rh

    Empleado table (I_Emp number (5), N_Emp varchar (20), Q_salary (8.2) number, number of I_boss (5), the number of I_Depto (1));

    i_emp n_emp q_salary i_boss i_dept

    Juan 100 300 null 1

    200 100 100 1 Pedro

    300 Angélique 150 100 1

    400 70 300 2 alberto

    500 60 300 2 Miriam

    600 3 500 80 moises

    And yet, I have 3 conditions:

    If the boss has 3 employees or more, he has increased his salary by 20%

    If the boss have 2 employees, there was an increase in his salary of 10%

    And if 0 or 1 employee, there is an increase of 5%

    herarchical diagram is like that

    -> Pedro Juan

    Juan-> Angelica-> Alberto

    Juan-Angelica-Miriam-Moses > > >

    I have to present the name of the Department (e_depto) in the console and the result should be like this;



    SQL > exec p_example ('finance');

    Employees of BOSS of the boss pay increase employees (name) boss of the salary increase employee employees employees

    juan             6                                              60                             pedro                                   0                                      5

    juan             6                                              60                             angelica                               3                                    45

    pedro           0                                                5                              NULL                                  0                                     0

    Angelica       3                                              45                              alberto                                0                                     5

    Anglica         3                                               45                              miriam                               1                                     3

    SQL > exec p_example ('shopping');

    Employees of BOSS of the boss pay increase employees (name) boss of the salary increase employee employees employees

    alberto             0                                              3.5                             -                                   0                                      0

    miriam             1                                                3                         moises                            0                                    4

    SQL > exec p_example('sistemas);

    Employees of BOSS of the boss pay increase employees (name) boss of the salary increase employee employees employees

    moises             0                                            4                              -                                  0                                      0

    His need to create a recurrence, stored procedure

    The query I have is this, but it only shows me that the boss and the boss employees.

    createor replace procedure deptos (depto varchar) as

    t_boss varchar (49);

    t_employ varchar (50);

    cursor c_depto (t_depto varchar) is

    Select a.n_emp boss, employee of b.n_emp

    of empleado a, b empleado, departamento d

    where a.i_emp = b.i_boss (+) and d.i_dept = a.i_dept

    and a.i_emp in (select i_EMP from empleado where i_dept = t_dept);

    Start

    Open c_depto (depto);

    loop

    extract the c_depto in t_boss t_employ;

    When the output c_depto % notfound;

    dbms_output.put_line (t_boss |) Chr (9) | Chr (9) | t_employ);

    end loop;

    end;

    /

    Hello

    I know it's a pain to post CREATE TABLE and INSERT statements for the sample data.  Think about why it is necessary: that people who want to help you can recreate the problem and test their ideas.  If you post statements that do not work, which does not recreate the problem or to test their ideas.  Test (and, if necessary, correct) your statements before committing.  Make sure all quotes are balanced.

    I don't understand the desired output.  For example, when n_emp = 'Juan', why is-employees_ofthe_boss = 6, 5 no?  When n_emp is 'Angelic', why is-salary_increase = 45, not 30?  When n_emp = 'Alberto', why is-salary_increase = 5, not 3.5?

    You may want something like this:

    WITH universe_dup AS

    (

    SELECT i_emp, n_emp, q_sueldo, i_jefe

    SYS_CONNECT_BY_PATH (i_emp, ","). ',' AS line

    ,       LEVEL                                    AS lvl

    Of empleado

    START WITH (IN) i_depto

    SELECT i_depto

    OF Department

    WHERE e_depto = 'Finance' - or what you want

    )

    CONNECT BY i_jefe = PRIOR i_emp

    )

    universe

    (

    SELECT i_emp, n_emp, q_sueldo, i_jefe

    MAX (lineage) DUNGEON (DENSE_RANK LAST ORDER BY lvl) AS lineage

    MIN AS min_level (lvl)

    Of universe_dup

    GROUP of i_emp, n_emp, q_sueldo, i_jefe

    )

    got_salary_increase AS

    (

    SELECT a.i_emp, a.n_emp, a.i_jefe, a.min_level

    EARL of (d.i_emp) AS employee_cnt

    , a.q_sueldo * CASE

    WHEN COUNT (d.i_emp) > = 3 PUIS.2

    WHEN COUNT (d.i_emp) = 2 PUIS.1

    OF AUTRE.05

    END AS salary_increase

    OF the universe a

    LEFT OUTER JOIN universe d ON d.lineage LIKE '%', | a.i_emp | ',%'

    AND d.i_emp <> a.i_emp

    GROUP OF a.i_emp, a.n_emp, a.i_jefe, a.min_level, a.q_sueldo

    )

    SELECT p.n_emp AS boss

    p.employee_cnt AS employees_ofthe_boss

    p.salary_increase AS salary_increase_boss

    c.n_emp AS employees_name

    , NVL (c.employee_cnt, 0) AS employees_ofthe_employee

    , NVL (c.salary_increase, 0) AS salary_increase_employee

    OF got_salary_increase P

    LEFT OUTER JOIN got_salary_increase c ON c.i_jefe = p.i_emp

    WHERE p.min_level = 1

    ;

    Depending on your data and your needs, it may be more effective to do "START WITH i_jefe IS NULL", as one of the above.  I guess "START WITH i_depto (...)" in the largest tables, when efficiency is more important.

  • setting report parameters fails for the report that runs the stored procedure in QMR FDM 2.1.1

    Hello

    Can someone help us please on this issue we have; If a solution is already available somewhere on the forum please link me to it.

    Please see our situation;

    The script below was part of the customization of a colleague to a script of Oracle FDM ("AftFileImport").

    There are no screenshots at this stage that came back to us with a temporary workaround.

    More detailed description:

    We built a custom report of FDM ("FSBValidationErrorsforAllLocations") that accepts two parameters (CatKey, period) and which calls a procedure stored in SQL Server with the same two parameters. FDM SQL statement of the report is:

    RUN FSBValidationErrorsforAllLocations ' ~ time ~', ~ Cat Key ~

    It works through the User Interface.

    When you try to put the two settings by customizing the event Oracle 'AftFileImport'script, the report fails. Below the part of the code in the 'AftFileImport', where we tried to fill values:

    • objReport.mParametersClear
    • objReport.mParametersAddNew "CatKey", RES. PstrCat
    • objReport.mParametersAddNew 'Period', RES. PstrPer

    We must understand why the way above to the definition of the parameters does not work with stored procedures, as seems to be the only documented way Oracle of setting parameters.

    Please let me know if that's enough.


    Thank you in advance.

    Hello

    which is the error when you run the script?

    • objReport.mParametersAddNew "Cat Key", RES. PstrCat

    Try again with the white space as it is how you named your parameter in the report definition, didn t you?

    Also try to use the built like the following examples:

    objRP.mParametersClear
    objRP.mParametersAddNew 'Period', CDate (dtePeriod)
    objRP.mParametersAddNew 'Loc', CLng (lngLocation)
    objRP.mParametersAddNew 'CatKey", CLng (lngCatKey)
    objRP.mParametersAddNew "TargAcct", CStr (strAutoMapAcct)

    Concerning

  • Materialized view, based on the stored procedure

    Hi all

    is it possible to create a materialized view on the results returned by a stored procedure?

    If this is not the case, do you think that any other way except for filling a table with data from the stored procedure and then founded the MV on it?

    Thanks in advance.

    MichaelTsilikidis wrote:

    Sorry I don't speak properly. In fact the procedure does not return a value, it fills one of its parameters (of the ref cursor type) of data. That's what I wanted.

    No it's not.

    REF CURSOR don't store data, so it's not possible.

    A Ref cursor is just a pointer to a query... and you can't "select from" a ref cursor, you can retrieve only one open.

    PL/SQL 101: Understand the Ref Cursor

    As correctly stated above, you can't question from a procedure to a function, and a materialized view is based on a query, you cannot use a procedure in a materialized view.

    You could use a function pipeline instead of a procedure, or have the pipeline function obtain the results of the procedure and pipelines, and then the materialized view could be based on the results of this function in the pipeline.

    example of function pipeline:

    SQL > CREATE or REPLACE TYPE AS OBJECT num_descript (num number, descript varchar2 (30))
    2.

    Type of creation.

    SQL >
    SQL > CREATE or REPLACE TYPE tbl_num_descript AS TABLE OF THE num_descript
    2.

    Type of creation.

    SQL >
    SQL >
    SQL > CREATE or REPLACE PACKAGE AS-reftest
    2 FUNCTION pipedata (number p_choice) tbl_num_descript RETURN PIPELINED;
    3 END;
    4.

    Package created.

    SQL >
    SQL > CREATE or REPLACE PACKAGE BODY AS-reftest
    2 FUNCTION pipedata (number p_choice) tbl_num_descript RETURN PIPELINED IS
    3 v_obj num_descript: = num_descript (NULL, NULL);
    4 v_rc sys_refcursor;
    5 BEGIN
    6. IF p_choice = 1 THEN
    7 v_rc OPEN to SELECT empno as num, ename like descript FROM emp;
    8 ELSIF p_choice = 2 THEN
    9 OPEN v_rc to SELECT deptno as num, dname as descript OF THE Department;
    10 END IF;
    11 LOOP
    12 FETCH v_rc INTO v_obj.num, v_obj.descript;
    EXIT 13 WHEN v_rc % NOTFOUND;
    14 PIPE ROW (v_obj);
    15 END LOOP;
    16 v_rc NARROW;
    RETURN 17;
    18 END;
    END 19;
    20.

    Package body created.

    SQL > select * from table (reftest.pipedata (1));

    DESCRIPT NUM
    ---------- ------------------------------
    7369 SMITH
    7499 ALLEN
    7521 WARD
    7566 JONES
    7654 MARTIN
    7698 BLAKE
    7782 CLARK
    7788 SCOTT
    KING 7839
    7844 TURNER
    7876 ADAMS
    JAMES 7900
    7902 FORD
    7934 MILLER

    14 selected lines.

    SQL > select * from table (reftest.pipedata (2));

    DESCRIPT NUM
    ---------- ------------------------------
    10 ACCOUNTING
    SEARCH 20
    30 SALES
    40 OPERATIONS

  • Link to database not be created using a stored procedure

    Hello

    I am creating a link of database using a stored procedure.

    Here is the code for it

    CREATE OR REPLACE PROCEDURE create_db_link (ca_db_name IN VARCHAR2,

    ca_service_name IN VARCHAR2)

    AUTHID CURRENT_USER IS

    BEGIN

    EXECUTE IMMEDIATE ' create public database link test_db_link connect to ca_db_name identified by ca_db_name using "ca_service_name" ';

    END create_db_link;

    During execution of the code is created the db_link. But, when I ask all_db_links I get the following result.

    OWNER

    ------------------------------

    DB_LINK

    --------------------------------------------------------------------------------

    USERNAME

    ------------------------------

    HOST

    --------------------------------------------------------------------------------

    CREATED

    ---------

    PUBLIC

    TEST_DB_LINK. WORLD

    CA_DB_NAME

    ca_service_name

    20 Aug 13

    Could you please help me understand why it shows the parameter names in the name column of the USER and the HOST instead of the name of the database and the name of the service?

    This is to show exactly what you said to do.

    Did you expect that Oracle would read as if by magic through your string you passed to run immediately and magically know to replace all occurrences of the string that correspond to local (or even global) parameter/variable names with the values of these variables?  It does not work like that.  You could concatenate the values into the string.

    for example

    EXECUTE IMMEDIATE ' create public database link test_db_link connect to ' | ca_db_name |' identified by ' | ca_db_name: ' using the "' | ca_service_name | " ' ;

    But why are create you database links running?  Shouldn't this be part of the design of your application and the initial fact before the application runs?

  • 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 to the stored procedure parameter passing script

    Hello

    I have a database on linux server. On the same server, there is a shell script which takes 3 parameters.

    Now I want to do a procedure (stored procedure) that will have 3 parameters pass and run this script with these settings.

    I had created object directory pointing to the correct directory granted all privileges on it (I hope).

    Now, I wondered how the code of procedure?

    I also did a program within the database which takes 3 parameters, but I don't know how to operate it. I don't know if I can use work to run the program, because

    It is a multi user thing and I think that this will not work as expected if 2 or more users run it.

    In any case, I was hoping that I can solve this problem by creating the procedure that will run the script that is provided with 3 parameters, that I need.

    I hope I'm clear on what I want to do.

    Please if you have an idea how to Edifier post your ideas.

    Thank you!

    Hello

    first I want to thank you for the reply.

    option 1... I don't want not to use java or c because I have no skills in programming languages.

    option 2 you mentioned dbms_scheduler.

    If I understand the procedure should go like that.

    I create whitin database program. Then I create a job which runs this program. And whenever I want to run my shell script, I'll do the work.

    WHA happen if 2 different users will want to run the script at the same time?

    Thank you for your response.

  • How to convert MS SQL Server 2008 Stored Procedures of Oracle 11 g SPs?

    We have an application from MS SQL Server 2008. We want to migrate to Oracle 11 g.

    What is the recommended Oracle method for
    (1) migration of data (Tables, triggers, sequences, views etc..)
    (2) the stored Procedure migration.

    What is the recommended tool or method pls?

    We have 100s of MS Sql Server stored procedures. Then, needing a tool or method. We can rewrite all of them from scratch.

    Hello

    Let me clarify some of the issues that you mention. But I advise you to get some professional help with migration because:

    1. you must understand the architectural differences between SQL Server and Oracle. They are of different databases.
    2. understand data type mappings.
    3. understand the complete migration process. Just using the OTN article as a migration guide won't help because it just shows how use SQL Developer to this task.
    4. understand that 100% of successful Oracle conversion is not possible with all the tools. There will always be gaps, gaps in functionality, bugs etc. So there will be some amount of manual work involved.
    5. There are many other tasks involved in the migration that cannot be accomplished with SQL Developer.

    Get now your questions:

    1. in 3.1, there is migration option for the "capture of database in offline mode". It is under the Tools option. So in 3.1 we do not have a separate tab, called "Migration."
    2. use 3.1 because it is much better than 2.1 in terms of capabilities.
    3 migration Wizard is the easiest way to migrate. Where are you getting confused?
    4 "column data" seems to be a stored procedure in SQL Server. If it is not there in the underlying table, why he uses in the SQL statement in the procedure then? I think that we have a problem of "reserved word" with the name of column "Data". Will have to check that.
    5 VARCHAR (@max) must be mapped to VARCHAR2 (4000) in Oracle. It may be a bug in SQL Developer. So during the mapping of data type in the migration wizard, you can change the default mappings.

    Concerning

    Prakash

  • View Vs stored procedure

    With the help of Oracle 11 g
    Front End .NET

    To display the data on the front end, we must query the DB tables and display. In this case, that is the best solution - views or procedures stored?

    1 b says:
    Is it okay that mantra?
    SQL > PL/SQL > C > JAVA
    and the view's SQL only, so it is better for performance reasons? TX

    Yes. But the mantra in this case means not PL/SQL allows to read the rows in the view, copy (fetch) in a collection (residing in the expensive PGA in memory) and who returns to the caller.

    It is false and so horribly.

    The right approach would be for the appellant NOT to use the view.

    Why? Because the appellant (program and app developer) need to understand the data model, need to understand SQL Oracle and the concepts of performance and so on.

    If the data model or the view changes - the app program should also be updated.

    This is why the use of a PL/SQL procedure is preferable. He resides in the database. (I hope), it is written by experienced database developers. The procedure can be modified to support the new features and changes to the data model, without having to touch a single line of code in the app program.

    All the procedure has to do is accept the call by the app program, decide how to build the SQL (on the view/table/whatever) for the caller, create a SQL Server Shared pool cursor and then return the handle of the cursor (using a ref cursor data type) to the appellant.

    Instead of the source of passage calling SQL for Oracle and get a cursor handle, the appellant seeks, so a PL/SQL procedure that returns the SQL cursor handle.

    The app program is now abstract concepts and database layer techniques Oracle and SQL, recursive SQL, analytical Oracle performance, Oracle CBO advice and so on. The PL/SQL procedure takes care of all this.

    This is why using a PL/SQL stored procedure would be a better choice that the client application dealing with the language of Oracle SQL and Oracle (such a view) in the database objects.

  • 'ALL' to a stored procedure in Oracle 10 g

    Hello

    I have a stored procedure that takes the parameters from a report. I have two settings with a list of things in both entities.

    Now, in the two settings, I have the word "ANYTHING" to pass to the stored procedure to indicate that all elements in the list of parameters should be consumed.

    I kinow what should be in the WHERE clause, but have no idea how to do this in Oracle. This pseudo code below to get an idea of what I'm trying to accomplish here;

    IF Parameter1 = "ALL".
    then
    Field1 = (select * from table1) other end parameter1 = Field1

    IF Parameter2 = "ALL".
    then
    Field2 = (select * from table2) other Field2 = parameter end 2


    Any help would be Apprecited guys!

    Thank you

    Manny

    Hey, Manny,

    I'm not sure that understand the question.
    I think you want something like this query on the table scott.emp:

    VARIABLE  target_deptno  VARCHAR2 (5)
    VARIABLE  target_job      VARCHAR2 (10)
    EXEC     :target_deptno      := 'ALL';
    EXEC      :target_job      := 'CLERK';
    
    SELECT  ename
    ,     deptno
    ,     job
    FROM     scott.emp
    WHERE     (     :target_deptno     = TO_CHAR (deptno)
         OR     :target_deptno     = 'ALL'
         )
    AND     (     :target_job     = job
         OR     :target_job      = 'ALL'
         )
    ;
    

    Output (with the settings as shown):

    ENAME          DEPTNO JOB
    ---------- ---------- ---------
    SMITH              20 CLERK
    ADAMS              20 CLERK
    JAMES              30 CLERK
    MILLER             10 CLERK
    

    Try it with different values for the parameters. If either of the parameters is 'EVERYTHING', then all values (and NULL) in this column are in agreement.

    In special cases (for example, if you know that deptno cannot be NULL) there is a little more simple ways to get the same results.

    I hope that answers your question.
    If not, post a small example data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and also publish outcomes from these data.
    Explain, using specific examples, how you get these results from these data. Given that this problem concerns the parameters, give a few sets of parameters and the results you want from the same sample for each game data.
    If you can show the problem using commonly available (such as in the diagrams of scott or HR) tables, then you need not display the sample data; After the desired effect and the explanation.
    Always tell what version of Oracle you are using.

Maybe you are looking for

  • talk to the sender when the e-mail is available in

    I love Eudora because my computer speaks of the sender and the subject. Thunderbird can this do? Thanks for any help!

  • Managing Plug-Ins

    I downloaded and tried a few plug-ins from third parties who are drafted for Aperture (more Photoshop, etc.). They worked fine, but don't actually do anything, I am interested. So I removed the my iMac. Unfortunately they still appear in the opening

  • Satellite U840-111 - Boot USB option not seen unless

    With the help of the Ultrabook I have prepared an "emergency" Ubuntu USB boot image (LinuxLive used to transfer a .iso downloaded to a USB device) on an SD card in a USB - SD adapter (the map is to a USB port, not the SD slot). It worked well. But wh

  • printer froze a document delete, cant it down

    I tried as an administrator. I tried to delete the printer, but it wont ' happen until the document has disappeared!

  • X 360 controller function key controls registered WMC play TV

    Is there any reference there about X 360 key function of controller during playback of live TV or recorded, when X 360 is used as extension WMC? I thought FF, RW, 30 s, skip and pause, but that's all I found. Grateful for your help!