Function procedures and triggers

Sorry to ask this question,


In oracle. We use the function of triggers and procedures.

for example:

If we wrote a trigger for a table. It fires both to manipulate the table. (database table contains data and database also contains triggers the same function, procedure).

but my questions?: is

In my database, I have not kept only tables. No trigger, no function, no procedures. and


I kept this triggers, function, procedures of data instead of I want kept this function, triggers, procedures in layers of logic (intermediate level)

is it possible? .


If yes means, how to write or where to write? Please help me, otherwise send guidance documents or the blog releated to it.

Hi Marie Laura,.
If you want to call the procedures used the following link
http://www.techartifact.com/blogs/2009/04/procedure-calling-in-Oracle-ADF.html

for my statement

all logic, triggers can be done using java classes that is attached with the business objects.

This means... in the procedure, you have selection, insertion, updating, and deleting of records in a table...
So map complete things as an object adf...

Tables-> object EO
Select the statement - > VO objects
Insert, update, deletion - crud-> dodML() operation, the remove() method in EntityImpl
commit - dbTransaction.commit)
other features... are also can be mapped to specific files, and can be represented as objects adf...

That's what I wanted to say, convert the whole procedure into objects of the adf and work on...
I hope you understand now...

Tags: Java

Similar Questions

  • 1.5.4 - packages, procedures and triggers are gone

    I recently downloaded and tried to start using the new version of SQL Developer, and I had to spend for my work soe because triggers and a few packages and procedures are not appearing in the navigation area.

    Any ideas?

    Restored dba_ queries * in the line of code 2.0.

  • last execution of procedure and relaxing time-out

    Hello

    How will I know when the procedure was executed the last time? I would like to know if some old procedures and triggers are used by any application or not.


    Thank you
    Sandy

    Oracle does not follow when a PL/SQL block was performed last time by default. The code itself would either need to write in a journal or your DBA would need enable auditing for you to follow this kind of thing.

    Justin

  • Call a procedure and a function over a db link

    I feel a few errors with the following and would be very happy in the view of some experts here.

    My use case is to insert records into a table via a database link. Inserted records will be interviewed for a same table in the local data dictionary. Everything works, but sometimes, I get a unique constraint violation if I'm trying to insert a duplicate record, so I wrote a simple function to check for the scenario. My problem is that I can run my procedure using the link to the db and I can run my function using the db link, but I can't use the two together without errors.

    My test scenario uses only the standard emp table:

    create or replace procedure test_insert(p_instance varchar2)
    IS
    l_sql varchar2(4000);
    begin
        l_sql := 'insert into EMP@'||p_instance||' (EMPNO, ENAME, JOB, MGR, SAL, DEPTNO) (Select EMPNO, ENAME, JOB, MGR, SAL, DEPTNO from EMP)';
    execute immediate l_sql;
    END;
    
    

    BEGIN
    test_insert('myLink');
    END;
    
    

    It works very well and the insert occurs without any problem.

    If I run the same process a second time, I get:

    00001 00000 - "forced single (s.%s) violated" which is what I've been waiting for EMPNO has a unique constraint. So far so good.

    Now, I create a function to check if the record exists:

    create or replace function record_exists(p_empno IN NUMBER, p_instance IN varchar2) return number
    IS
    l_sql varchar2(4000);
    l_count number;
    BEGIN
    l_sql := 'select count(*) from EMP@'||p_instance||' where empno = '||p_empno;
    execute immediate l_sql into l_count;
    IF
    l_count > 0
    THEN return 1;
    ELSE
    return 0;
    END IF;
    END;
    
    

    I test this situation as follows:

    select record_exists(8020, 'myLink') from dual;
    
    

    RECORD_EXISTS(8020,'myLink')

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

    1

    That works well, so now I'll add this feature to my procedure:

    create or replace procedure test_insert(p_instance varchar2)
    IS
    l_sql varchar2(4000);
    begin
        l_sql := 'insert into EMP@'||p_instance||' (EMPNO, ENAME, JOB, MGR, SAL, DEPTNO) (Select EMPNO, ENAME, JOB, MGR, SAL, DEPTNO from EMP WHERE record_exists( EMPNO, '''||p_instance||''') = 0)';
    execute immediate l_sql;
    END;
    
    

    I test this situation as follows:

    BEGIN
    test_insert('myLink');
    END;
    
    

    As a result:

    Error report:
    ORA-02069: global_names parameter must be set to TRUE for this operation
    ORA-06512: at "FUSION.TEST_INSERT", line 6
    ORA-06512: at line 2
    02069. 00000 -  "global_names parameter must be set to TRUE for this operation"
    *Cause:    A remote mapping of the statement is required but cannot be achieved
               because global_names should be set to TRUE for it to be achieved
    *Action:   Issue alter session set global_names = true if possible
    
    

    I don't know why I'm getting this. The function works, the works of the procedure, but when I combine I get an error. If I set the global setting to true names and then run again I get:

    
    02085. 00000 -  "database link %s connects to %s"
    *Cause:    a database link connected to a database with a different name.
               The connection is rejected.
    *Action:   create a database link with the same name as the database it
               connects to, or set global_names=false.
    
    

    All opinions are appreciated. I do not understand why I can run the procedure and function of each separately on the db connection, but they don't work together.

    Thank you

    John

    The procedure depends on what how would you define failure and it should mean - error to the caller, sign and continue, just continue. Constraints are created to ensure if it receives no invalid data in a table. Generally, they provide the most effective mechanism for the verification of the invalid data and return useful exceptions that can deal with the appellant. You also double the workload of the checking uniqueness by adding your own control.

    In general I would say use Exceptions, they are your friend

  • differences between the procedures and functions.

    a little confusing... differences between procedures and functions...

    1. a function returns only the unique value? can't return us multiple values?

    2. can we use clause of 'back' and 'out' parameter at the same time in the same function

    Thank you

    Hello

    Simply create a TYPE for strong cursors, returning the specified columns. For genereic, or the low sliders, there is a TYPE integrated, namely SYS_REFCURSOR.

    Try this:

    CREATE OR REPLACE function test_f(p_DEPTNO  in emp.DEPTNO%type)
      return SYS_REFCURSOR
      as
         REF_C     SYS_REFCURSOR;
    BEGIN
         OPEN  REF_C  FOR   SELECT  *
                             FROM    EMP
                      WHERE   DEPTNO = P_DEPTNO;
         RETURN REF_C;
    END;
    

    You don't want to close the cursor service.

    Always format your code.

  • Private procedures and functions

    Hi all

    I am struggling to find a way to the list of private procedures and functions that are not declared in the package specification.
    Are there data dict. table or a view that could help

    DBA_procedures only the list procedure and functions that are declared in the package Spec.


    Thanks in advance.

    This is what the intended behavior is that if the procedure /function is prviate, it must not be visible. Have you tried to check in dba_source ?

    Aman...

  • What is the difference between procedure and function?

    Hello
    I want to know the difference between procedure and function.
    Also, I want to know the types (if any) of procedures and functions.

    Concerning

    A function requires a return value.

    A procedure, while allowing the option PARAMETERS, mandates without return.

  • How to query the DDL lock functions or stored procedures and packages?

    Hello!

    The subject says it all: how to display existing DDL locks on the functions or stored procedures and packages?

    While running a procedure, it cannot be deleted or replaced, so there must be a DDL lock on it. The information does not seem to be in V$ LOCK or V$ LOCKED_OBJECTS.

    Thank you!
    Marcus

    Published by: David on November 21, 2009 15:43

    Hello

    You have the DBA_DDL_LOCKS view.

    Best regards
    Jean Valentine

  • Stored procedure and stored function

    Greetings from a newbie,
    Question about procedure and function:
    When we use procedure and function? What is the difference between the two?

    Kind regards
    Valerie

    Published by: Valerie debonair on August 24, 2009 21:27

    When we use procedure and function?

    If you need to compute and value, good idea to use the function to return.
    If you need data DML, good idea to use the procedure...

    What is the difference between the two?

    A FUNCTION is always returns a value using the return statement.
    A PROCEDURE can return one or more values through parameters or may not return at all.

  • two related issues: to call the stored procedure and passing in an array of elements using htmldb_Get

    I need to save items of ApEx generated dynamically via AJAX.  I use the APEX_ITEM API to generate the elements.  At runtime, I have no idea how much of elements are generated on the page, but I know that they're all separate and discreet 'name' attributes, i.e. f01, f02, f03, etc..  As a basic example, if I have to generate a selection list, I know that the parameter "p_idx" of the APEX_ITEM call is to say '3', so select all lists that get generated have a "name" attribute in "f03" DOM, all text elements will be "f01", etc.

    I want to record these data in the database using AJAX.  It is common to call the javascript htmldb_Get function that is standard for the use of an application process, but I am interested in the use of the rarely called upon 'internal' and queryString"options of this javascript function so that I can build the query string to the fly according to what is on the DOM when it tries to save the data they have entered into these items generated by APEX_ITEM.  Someone at - there are good examples of the use of the 'procedure' and 'queryString' the javascript htmldb_Get function parameters?

    I have found a handful of some blogs, messages, etc. online linked to this, but just for most people regurgitate the documentation.  I found this post (https://forums.oracle.com/thread/2549237), which has had a glimpse of hope to move from a table (which is something I need) as a parameter, but as someone in their right mind would check this before you go this route.

    Shane.

    ApEx 4.2.1

    Shane

    Since you mention that you are on 4.2 APEX I advise to use apex.server.process which is replacing the htmldb_Get officially undocumented documented.

    In the literature, it is that the first parameter is the ajaxidentifier but it's actually the name of the process.

    The data object would be something like

    var lData ={f01 : get_value_array('f01')}
    

    Where is get_value_array

    function get_value_array(pColumnName) {
      var l_values =[];
      apex.jQuery('[name="'+pColumnName+'"]').each(
       function(){
        var l_value;
        l_value = apex.item(this.id).getValue();
        l_values.push(l_value);
       }
      );
      return l_values
    }
    

    For an example see this demo.

    Nicolette

  • Problems of syntax with a Variable/function/procedure

    Hello
    Some time ago I had advice how to define a simple (not stored) procedure within a PL/SQL Script, see procedure but not stored now, I tried to expand the sample by the use of some additional variables and a function instead of a procedure. The result expected from the following (pseudo) - code is very clear, but I get tons of errors due to problems of syntax. Of course I don't have need of all these variables in the example below, but it's the syntax I will need later. Maybe you can point me to an example which has a similar structure.

    DECLARE  
    
        -- Output Comment and 2*Input
        PROCEDURE OutputDouble(SingleValue IN Number, MyComment IN VARCHAR) IS
            variable MyTextResult VARCHAR(100); 
        BEGIN
            SELECT MyComment || ' ' || to_char(2 * SingleValue)) into MyTextResult from dual;
            dbms_output.put_line(MyResult);
        END;
        
        -- Return Product of Val1 and Val2
        FUNCTION MyProduct(Val1 IN NUMBER, Val2 IN NUMBER) IS
            variable MyNumResult Number := 0;
            returns Number
        BEGIN
            MyNumResult := Val1 *Val2;
            return MyNumResult;
        END;
    
       -- Definitions
       variable MyRes  Number;
       variable MyVal3 Number := 3;
       variable MyTxt3 VARCHAR(30) := 'Text mit 3';
     
    BEGIN
        
        -- Main process block
        OutputDouble(MyVal3, MyTxt3);
        MyRes = MyProduct(MyVal3, 5);
        dbms_output.put_line('Produkt: ' || to_char(MyRes)); 
        
    END;
    /
    Published by: netaktiv on 21.02.2012 13:24

    Published by: netaktiv on 21.02.2012 13:25

    (1) If you declare procedures in an anonymous PL/SQL block (which itself is not a particularly good way to organize the code), the procedure for declarations must come after all the variables are declared.
    (2) you do not use the keyword VARIABLE when you declare variables in PL/SQL
    (3) you have a fence extra paren in the SELECT statement in the OutputDouble that needs to be removed
    (4) the appeal dbms_output.put_line in OutputDouble should, without doubt, refer to the variable local MyTextResult, not same that does not exist.
    (5) the RETURN clause in the declaration of a function must be unique and must come before the IS
    (6) add a little more indented is useful for the following code.

    Put it all together, something like this works

    SQL> ed
    Wrote file afiedt.buf
    
      1  DECLARE
      2     -- Definitions
      3     MyRes  Number;
      4     MyVal3 Number := 3;
      5     MyTxt3 VARCHAR(30) := 'Text mit 3';
      6      -- Output Comment and 2*Input
      7      PROCEDURE OutputDouble(SingleValue IN Number, MyComment IN VARCHAR)
      8      IS
      9          MyTextResult VARCHAR(100);
     10      BEGIN
     11          SELECT MyComment || ' ' || to_char(2 * SingleValue)
     12            into MyTextResult
     13            from dual;
     14          dbms_output.put_line(MyTextResult);
     15      END;
     16      -- Return Product of Val1 and Val2
     17      FUNCTION MyProduct(Val1 IN NUMBER, Val2 IN NUMBER)
     18          return Number
     19      IS
     20          MyNumResult Number := 0;
     21      BEGIN
     22          MyNumResult := Val1 *Val2;
     23          return MyNumResult;
     24      END;
     25  BEGIN
     26      -- Main process block
     27      OutputDouble(MyVal3, MyTxt3);
     28      MyRes := MyProduct(MyVal3, 5);
     29      dbms_output.put_line('Produkt: ' || to_char(MyRes));
     30* END;
    SQL> /
    Text mit 3 6
    Produkt: 15
    

    As I said above, however, this isn't a particularly good way to code generation. You are much better (a lot!) create a procedure as OutputDouble first just debugging that, then create a function like MyProduct, debugging that and then just try to put it all together. Creating a single block that declares its own procedures and functions only makes it harder to debug and harder to generate the code of the work by the Assembly and testing of small building blocks.

    Justin

  • How PLSQL functions/procedures by ODI dynamically

    I want to know is there a way to create functions or procedures on the Oracle database through procedures ODI dynamically.
    These are functions that I need to dynamically create by the ODI process so that when the procedure runs the following function is created at the database level.

    FUNCTION to CREATE or REPLACE MY2DATE (p_str IN VARCHAR2
    format_picture IN VARCHAR2
    )
    DATE OF RETURN
    IS
    BEGIN
    RETURN TO_DATE (p_str, format_picture);
    EXCEPTION
    WHILE OTHERS
    THEN
    RETURNS A NULL VALUE.
    END;
    /


    Any help appreciated

    Hello

    Create an ODI procedure and co-pilot on target, select

    Technologies: Oracle
    Logical schema:

    Command:

    FUNCTION to CREATE or REPLACE MY2DATE (p_str IN VARCHAR2, format_picture IN VARCHAR2)
    DATE OF RETURN
    IS
    BEGIN
    RETURN TO_DATE (p_str, format_picture);
    EXCEPTION
    WHILE OTHERS
    THEN
    RETURNS A NULL VALUE.
    END;

    ODI will create it in the backend.

    ARY: http://odiexperts.com/how-to-use-plsql-procedures-and-functions-in-odi

    Thank you
    Guru

  • Input parameters for the function/procedures

    Hello

    I have an input parameter in varchar2 to a procedure and a function.

    Oracle says that you can pass to the maximum value of 32767 bytes inside a pl/sql block for a varchar2.

    But outside, it is limited to 4000 bytes.

    Here, there is a small suitcase of test
    create or replace procedure test_p(a in varchar2) as 
     begin
      null;
       commit;
         End;
    
    CREATE OR REPLACE FUNCTION str2tbText(p_str in varchar2) return varchar2
            IS
                      begin
                return null;
          END str2tbText;
    
    SQL> declare
      2  a varchar2(32767);
      3  b varchar2(32767);
      4  c varchar2(32767);
      5  begin
      6  for i in 1..4004 loop
      7  b:=b||'a,';
      8  end loop;
      9  test_p(b);
     10  --select str2tbtext(b) into c from dual;
     11  commit;
     12  end;
     13
     14  /
    
    PL/SQL procedure successfully completed.
    
    SQL> declare
      2  a varchar2(32767);
      3  b varchar2(32767);
      4  c varchar2(32767);
      5  begin
      6  for i in 1..4004 loop
      7  b:=b||'a,';
      8  end loop;
      9  --test_p(b);
     10  select str2tbtext(b) into c from dual;
     11  commit;
     12  end;
     13
     14  /
    declare
    *
    ERROR at line 1:
    ORA-01460: unimplemented or unreasonable conversion requested
    ORA-06512: at line 10
    IAM here to more than 4000 bytes as an input parameter for a function of years of proceedings,
    But it works for the procedure...
    For the function, it throws error

    No specific reason please...

    Kind regards
    Mohammed

    This means that you have found the answer you're looking for? Then you can close the thread...

  • function v and nv

    Hello
    I'm in an environment where there is an apex server and a database server. All built-in database objects are the link to server apex via data links. I used the function v and nv via a stored procedure like so on the server of the apex:
    CREATE OR REPLACE
    PROCEDURE PR_INS_TMP_STUDENTS(
    v_tmp_stu_id_in     IN      NUMBER
    )
    IS
    BEGIN
     
     
      INSERT INTO TMP_STUDENTS (
          stu_id,
          stu_name_last,
             stu_name_first,
             stu_name_middle,
             stu_name_suffix,
             stu_name_prefer_last,
          stu_name_prefer_first,
          sch_id
          )
      VALUES (
          v_tmp_stu_id_out,
          v('p50100_stu_name_last'),
          v('p50100_stu_name_first'),
          v('p50100_stu_name_middle'),
          v('p50100_stu_name_suffix'),
          v('p50100_stu_name_prefer_last'),
          v('p50100_stu_name_prefer_first'),
          nv('p50100_sch_id')
          );
     
    END;
    It works fine on the server of the apex, but when I moved the procedure on the database server, it didn't compile. He complains about PL/SQL: ORA-00904: "V": invalid identifier.
    How can I get the function v and nv to work on the side of the database?

    Hello:

    The 'v' and 'nv' functions are available only on databases including the installed APEX. In addition, the functions are only when invoked on an application of the APEX.
    Therefore, calling these functions on your term as your server "database" is empty.
    You might want to consider changing your procedure as follows:

    CREATE OR REPLACE
    PROCEDURE PR_INS_TMP_STUDENTS(
    v_tmp_stu_id_in     IN      NUMBER
     p_stu_name_first IN VARCHAR2,
    P_ stu_name_middle IN VARCHAR2,
    p_ stu_name_suffix IN VARCHAR2,
    p_ stu_name_prefer_last IN VARCHAR2,
    p_ stu_name_prefer_first IN VARCHAR2,
    p_sch_id  IN VARCHAR2
    )
    IS
    BEGIN
    
      INSERT INTO TMP_STUDENTS (
          stu_id,
          stu_name_last,
             stu_name_first,
             stu_name_middle,
             stu_name_suffix,
             stu_name_prefer_last,
          stu_name_prefer_first,
          sch_id
          )
      VALUES (
          v_tmp_stu_id_out,
          p_stu_name_first,
         p_ stu_name_middle,
         p_stu_name_suffix,
         p_stu_name_prefer_last,
          p_stu_name_prefer_first,
          p_sch_id
          );
    
    END;
    
    --- Call form APEX
    begin
    PR_INS_TMP_STUDENTS(
    v_tmp_stu_id_in
     v('p50100_stu_name_last'),
          v('p50100_stu_name_first'),
          v('p50100_stu_name_middle'),
          v('p50100_stu_name_suffix'),
          v('p50100_stu_name_prefer_last'),
          v('p50100_stu_name_prefer_first'),
          nv('p50100_sch_id')
    );
    end
    
    -- Call from outside APEX
    
    begin
    PR_INS_TMP_STUDENTS(
    v_tmp_stu_id_in,
    l_ stu_name_middle,
    l_stu_name_suffix,
    l_stu_name_prefer_last,
    l_stu_name_prefer_first,
    l_sch_id
    );
    end
    

    CITY

  • Functions/procedures of conclusion an orphan?

    Hi all
    I'm trying to go through our code to find orphaned procedures and functions. I'm using TOAD for a search object for their names, but it is extremely painful. Is it possible to quickly find the names of all the procedures and functions that are not referenced within any other procedure or function?

    Thanks for your time!

    I am not sure I understand...

    How do you know that an application or user will not call the procedure or function?

    You will always have at least a procedure that is not referenced by another procedure... because it's the one that starts the whole process.

    However, I do not think that ALL_DEPENDENCIES meets the needs you describe as for finding links... you can probably do a negative join between her and object (I think)

    http://download.Oracle.com/docs/CD/B19306_01/server.102/b14237/statviews_1041.htm#i1576452
    http://download.Oracle.com/docs/CD/B19306_01/server.102/b14237/statviews_2005.htm#i1583352

    Concerning
    Tim

Maybe you are looking for