MAKING A PROCEDURE

Hi,
I'm not a PL/SQL developper but my cheaf asked me to do this :
use AddResp(username varchar2,
resp_app varchar2,
resp_key varchar2,
security_group varchar2,
description varchar2,
start_date date,
end_date date) instead.
General steps :
1. Use this query in cursor loop
select d.product_code,b.responsibility_key from FND_USER_RESP_GROUPS_ALL a,fnd_responsibility b,fnd_user c,fnd_application d
where a.user_id = c.user_id
and a.responsibility_id = b.responsibility_id
and b.application_id = d.application_id
and c.user_name = <username you want to copy>
2.and use FND_USER_PKG.AddResp
3. end loop
Would you please help me ?

an example would be:
Declare
  vCtr     Number := 0;
Begin
  For c1_rec in (select d.product_code,b.responsibility_key
                   from FND_USER_RESP_GROUPS_ALL a,
                        fnd_responsibility b,
                        fnd_user c,
                        fnd_application d
                  where a.user_id = c.user_id
                    and a.responsibility_id = b.responsibility_id
                    and b.application_id = d.application_id
                    and c.user_name = <username you want to copy>) Loop
    vCtr := vCtr + 1;
    <code goes here...>
  End Loop;
End;
/

Similar Messages

  • SET_UPDATE_CONFLICT_HANDLER is making all procedures invalid

    Oracle version 10.2.0.3
    DECLARE
    cols DBMS_UTILITY.NAME_ARRAY;
    BEGIN
    cols(1) := 'EMP_PK';
    cols(2) := 'TIMESTAMP';
    DBMS_APPLY_ADM.SET_UPDATE_CONFLICT_HANDLER(object_name => 'SEMP.EMP',method_name => 'MAXIMUM', resolution_column => TIMESTAMP, column_list =>cols);
    END;
    This is making all procedure using that table invalid.

    Check if you are modifying any other column as well. May be if you have LOG_ID column or something like this. Try to add all table columns in the column list.
    The other way is to try to exclude columns with DBMS_APPLY_ADM.COMPARE_OLD_VALUES() procedure.
    Svetoslav

  • Making a procedure to work against 8i, 9i and 10g databases

    Hello all,
    I made a procedure that gathers info from user. At some point I execute this part of code:
    CURSOR tabPrivs IS
    SELECT owner, table_name, privilege, grantable, hierarchy
    FROM dba_tab_privs
    WHERE grantee = uName;
    At first my procedure was only for 9i and 10g databases. I tried it once on 8i and get the logical error that the hierarchy column doesn't exist in the table dba_tab_privs.
    I want my procedure to work against all versions of databases so I tried to do an additional select if the database version was upper than 8, but it seems that it won't compute, as if before executing my procedure, the engine look to all the select I am trying to do and check if they are correct.
    I want to know if there's a work-around because I want to provide the most generic procedure possible.
    Thank you,

    You need to declare your cursor according to your DB version. Something like this might keep you going:
    DECLARE
       VERSION         VARCHAR2 (30);
       COMPATIBILITY   VARCHAR2 (30);
       uname           VARCHAR2 (30);
       TYPE cur IS REF CURSOR;
       p_sys           cur;
    BEGIN
       DBMS_UTILITY.db_version (VERSION, COMPATIBILITY);
       IF VERSION LIKE '10%' OR VERSION LIKE '9%'
       THEN
          OPEN p_sys FOR 'SELECT owner, table_name, PRIVILEGE, grantable, HIERARCHY
               FROM dba_tab_privs
              WHERE grantee = :uname' USING uname;
       ELSIF VERSION LIKE '8%'
       THEN
          OPEN p_sys FOR 'SELECT owner, table_name, PRIVILEGE, grantable
               FROM dba_tab_privs
              WHERE grantee = :uname' USING uname;
       END IF;
       do_your_fetch_and_work_here;
       CLOSE p_sys;
    END;

  • DBMS_schedular.create_job procedure

    HI ,
    I am trying write a scheduler for one of the Pl/SQL package...
    Here is the package i m trying to schedule...This works absolutely fine
      --- Spec
    create or replace package my_pack
    as
    begin
    procedure common_proc(var_num number);
    end;
      --- Body
    create or replace package body my_pack
    as
      procedure insert_tbl1(v_num number)
       is
        begin
           insert into tbl1 values (....)
              select ....from src_tbl where col1 = v_num and ...and...;
       end;
       procedure insert_tbl2(v_num number)
        is
        begin
           insert into tbl2 values (....)
              select ....from src_tb1 where col1 = v_num and ...and...;
       end;      
       procedure insert_tbl3(v_num number)
        is
        begin
           insert into tbl3 values (....)
              select ....from src_tb1 where col1 = v_num  and ...and...;
       end;
       procedure insert_tbl4(v_num number)
        is
        begin
           insert into tbl4 values (....)
              select ....from src_tb1 where col1 = v_num  and ...and...;
       end;  
      procedure common_proc(var_num number )
      as
       begin
            insert_tbl1(var_num);
            insert_tbl2(var_num);
            insert_tbl3(var_num);
            insert_tbl4(var_num);
       end;            
    end my_pack;
    Here is the procedure for scheduling the above package...
      create or replace procedure  schedule(s_num in number )
         as
       var_1 varchar2; -- sqlstr
       var_2 varchar2;  -- v_jobn
       begin
         var_1 := 'my_pack.common_proc('''||s_num||''');';
         dbms_output.put_line(var_1);
         var_2 := 'my_pack_'||to_char(s_num);
         dbms_output.put_line('job name :'||var_2);
         dbms_schedular.create_job(
                                       job_name => var_2
                                      ,job_type => 'PLSQL_BLOCK'
                                      ,job_action => 'begin '||var_1||' end; '
                                      ,start_date => NULL
                                      ,repeat_interval => NULL
                                      ,enabled => TRUE
                                      ,comments => null
                                      ,auto_drop => TRUE 
       exception
         when others then
         raise;
       end schedule;
    When i compile the above schedule procedure, i get the following error
       PLS-00201: identifier 'DBMS_SCHEDULER' must be declared
    ANy idea why ???Next question,
    - how would i test this scheduler?? do i need to run the procedure with passing the parameter or how would i know whether schedular is kicked off or running or any place i can i see the logs ???
    - If you have any idea of making this procedure schedule to write in a efficient way, please feel free to suggest me
    last thing, i m tottally new to schedular, this is the first time i m using it..
    Your suggestions or advice or help is greatly appriciated!!!
    thank you so much !!!

    I think you are missing the privileges.
    GRANT CREATE JOB,MANAGE SCHEDULER to <user>;
    They have explained scheduler here : http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_sched.htm#i1000363
    Since you are setting the start_date to null, the job will be executed as soon as it gets created.
    You can check the status of the run by:
    SELECT * FROM USER_SCHEDULER_JOB_RUN_DETAILS
    WHERE job_name = <>
    ORDER BY log_Date DESC;
    You can see the running jobs by:
    select job_name
    , session_id
    , running_instance
    , elapsed_time
    , cpu_used
    from USER_SCHEDULER_RUNNING_JOBS;
    Note that there are "DBA" counterparts of these tables too.

  • How to configure Oracle execute concurrently ?

    Hi everybody,
    I've developed an application that need to to insert a lot of data at a time and also need speed. If i i insert data sequentially, it run very slow. So, i 've create some Thread (about 30 threads) for inserting. But the speed is not imporoved. It is even slower than when i insert sequentially. How to solve this? are there any options while installing for concurrently insert?
    Currently, I use Oracle 10g (10.2.0) on Windows 7 64bits and i've installed it with basic option(default option). Do i have to change to Oracle 11g? If need, i'll change.
    Edited by: user1071695 on 03:21 12-06-2011
    Edited by: user1071695 on 03:26 12-06-2011
    Edited by: user1071695 on 04:35 12-06-2011

    How many rows are you inserting?
    Are you making one procedure call to insert all the data? Or are you making one procedure call for every row you are inserting?
    Are you making one network round trip for each procedure call? Or are you batching many procedure calls for every round trip?
    Are you doing conventional path inserts? Or direct path inserts?
    Justin

  • How can i create a new user?

    Is it possible to create a new portal user with java(or jsp) which is writen by myself?
    The program makes user become a new member automatically when he login.

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Allen Lin ([email protected]):
    Is it possible to create a new portal user with java(or jsp) which is writen by myself?
    The program makes user become a new member automatically when he login.<HR></BLOCKQUOTE>
    This is definitly possible. In my perspective
    it consist out of two steps: customing your login-screen and making a procedure which adds an new user to portal.
    The customizing of the login screen is only a extra call to the new procedure.
    The procedure is a bit more diffcult, you have to make an user and add rights to him.
    I already have a document containing the way to customize a loginscreen.
    I also have a sql-package wich adds an user to portal(from outside portal), but the description and inline documentation are in dutch. So I have to do some work on that.
    If you are interesed mail me at [email protected]
    regards
    arny

  • Search a string in a blob

    I need urgent help
    regarding blobs in Oracle8i
    database on SuSe-Linux.
    I'm trying to make a procedure
    searching for patterns in a blob.
    The procedure is allways invalid
    with errors regarding hextoraw or raw.
    I'm making this procedure based on an example of technet.oracle.com
    (EXAMPLE_13A).
    Up to now I'm doing it by saving
    the blobs as clobs
    and searching in the clobs (it doesn't
    works with pdf).
    But this is no acceptable solution.
    Can somebody give me an example or advice how to proceed?
    Additionally I'd like to know how a string can be converted
    into raw- or hextoraw format.
    For your information: We have interMedia but we can not make it
    run on Linux.
    null

    If the BLOB is smaller than 32767 in length, you can simply:
    DECLARE
       p_blob   BLOB := UTL_RAW.cast_to_raw (RPAD ('X', 32767));
    BEGIN
       p_blob :=
          UTL_RAW.cast_to_raw (REPLACE (UTL_RAW.cast_to_varchar2 (p_blob),
                                        'X',
                                        'Y'
    END;

  • "print" command in Mathscript not saving plots in BMP format!

    Hi guys,
    i am trying to create a vi that will automatically generate a pdf report for my project. I found a way to save the report directly as pdf (that is, i "print" my report to a virtual PDF printer (PDFCreator) that saves the file automatically to a specific folder with the date/time as its name. So this was the first step to making the procedure automatic).
    I am stuck in the next level, which is adding to the report not labview's bad-looking graphs, but the plots generated through the Mathscript.
    So, after adding as input "a" my data to the mathscript node, i use the following commands:
    figure
    plot(a)
    print image
    Now, what this sequence does is make a nice plot of my data and then save it as "image.eps" in the default folder.
    However, the eps format is not at all useful to me as i cannot import the plot with the "Append Image To Report.vi". This vi supports only BMP, GIF, WMF, EMF and JPG formats.
    So, i want to save the plot from mathscript as BMP. This is supposedly possible, however i have not been able to find a way. The "print" command help for Labview 2011 Mathscript reads:
    http://zone.ni.com/reference/en-XX/help/373123B-01/lvtextmath/msfunc_print/
    Syntax
    print
    print(a)
    print(file)
    print(a, file)
    Description
    Print the plot window or save it into a file in either BMP or EPS format. If the plot window to save is an image plot or a 3D plot, the file must be in BMP format. For other kinds of plots, both BMP and EPS formats are supported.
    There is no way for me to choose which format i want and it automatically chooses eps. If i use the command
    print image.bmp
    it gives me back an error. So, adding the .bmp ending is not the way to go.
    All in all, it is crucial for me to export the plot in BMP format (so as to import it in the report generation), but i cannot find a way, althouth it is supposed to work.
    Any ideas????
    Thanks
    PS. I run Labview 2011 SP1
    Solved!
    Go to Solution.

    Thanks a lot ttrr!!

  • Problems using 'IN' clause

    I'm making a procedure, and it has a cursor. This cursor receive some parameters and one of them is a list of numbers, the list can't be a VARCHAR2 with ',' or ';' as separator, because it doesn't work, if I use a defined type like 'vet IS TABLE OF NUMBER INDEX BY BINARY_INTEGER' it doesn't work either. The cursor is necessary because it return many output. Here is my code:
    PROCEDURE pr_busca_equipamento (
    id_pos IN NUMBER,
    tipo_posicao IN VARCHAR2,
    empresa IN NUMBER,
    nro_serie IN VARCHAR2,
    id_item IN NUMBER,
    status IN NUMBER,
    id_equipamento OUT vetornum, -- table of number...
    desc_equip OUT vetorchar, -- table of varchar2..
    caminho_completo OUT vetorchar,
    nro_serie_out OUT vetorchar,
    status_out OUT vetornum,
    quantidade OUT NUMBER,
    erro_cod OUT VARCHAR2,
    erro_msg OUT VARCHAR2
    IS
    CURSOR c_busca_equip(
    id_p NUMBER,
    tipo_p VARCHAR2,
    emp NUMBER,
    nroser VARCHAR2, -- or vetorchar
    id_i NUMBER,
    stat NUMBER)
    IS
    SELECT eq.id_equipamento,
    nroserie,
    id_status,
    id_item
    FROM EQUIPAMENTOS EQ,
    EQUIPAMENTOS_POSICAO EP
    WHERE (eq.id_equipamento = ep.id_equipamento AND ep.id_posicao = id_p)
    AND (id_i IS NULL OR id_item = id_i)
    AND (stat IS NULL OR id_status = stat)
    AND (nroser IS NULL OR nroserie IN (nroser)) -- my problem is nroser
    AND (emp IS NULL OR id_empresa_responsavel = emp);
    ...

    Marcelo,
    You can make this work using a VARCHAR2 list separated with commas if you write a 'dynamic' cursor.
    For example:
    PROCEDURE process_emp (p_deptno IN VARCHAR2)
    IS
    TYPE my_cur_type IS REF CURSOR; -- could be declared as a strong refcursor (e.g. RETURN emp%ROWTYPE)
    my_cur my_cur_type;
    emp_rec emp%ROWTYPE; --or declare the appropriate record structure
    BEGIN
    OPEN my_cur FOR 'select * from emp where deptno in ('||p_deptno||')';
    LOOP
    FETCH my_cur INTO emp_rec;
    EXIT WHEN my_cur%NOTFOUND;
    -- process the row returned from the cursor e.g.
    htp.p(emp_rec.ename||' earns '||to_char(emp_rec.sal,'fm$999,999'));
    END LOOP;
    CLOSE my_cur;
    END;
    Hope this helps.
    Cheers,
    Bryan.

  • Commits after dbms_job submit

    All,
    a question regarding dbms_job.submit..
    Is it necessary to commit after calling dbms_job.submit. My job seems to be running only after calling commit after submit (although i see and entry for that job in user_jobs). Is there any setting that needs to be done to make it default ?
    Here is the snippet of code:
    PROCEDURE start_sync_job (i_sync_interval IN NUMBER) IS
    l_jobno NUMBER :=0;
    l_job_count NUMBER :=0;
    BEGIN
    dbms_job.submit(l_jobno, 'begin SS_PKG.sync_job; end;',
    SYSDATE + 1/1440, 'SYSDATE + '||i_sync_interval||'/1440');
    END;
    Thx,
    Rakesh

    This is not a problem of the dbms_job.submit, it is
    the problem of SS_PKG.sync_job ,I think someone
    forget issue commit inside this procedure(package).It is not.
    The SS_PKG.sync_job procedure will run via the dbms_job queue only when a commit is issued after calling dbms_job.submit. The commit inside the code for SS_PKG.sync_job procedure would not help in making the procedure run via the job queue.
    As mentioned by OP:
    My job seems to be running only after calling commit after submitMessage was edited by:
    Kamal Kishore

  • Build mapping using the CONNECT BY logic...?

    Environment:
    OWB 10g Client on Windows XP Professional
    Repository - 9.2.0.4 on UNIX (AIX 5.2)
    Target - 9.2.0.4 - on UNIX (AIX 5.2)
    Is it possible to create a summary table mapping that uses the CONNECT BY hierarchical logic of SQL?
    I realize that I can put it in a procedure and execute that procedure as a post-mapping event, but in this case I need the procedure to be the only activity going on in the mapping.
    I can also plug the SQL into a materialized view but I wanted to see if there was some functionality that I was not getting from the documentation.
    Many thanks all suggestions.
    Gary

    Hi,
    Have you found a solution ?
    If not read on :
    I think your solution of making a procedure and calling it in a mapping is the best idea. But since you said that that there would be nothing else in the mapping, I believe you have to do a dummy mapping. That is, map the fact / dimension to itself, with the load type of the target fact/ dimension to 'NONE'. Also, set the operator property of the pre-mapping process to execute 'ALWAYS'.
    Hope this helps.
    Regards,
    V.Usha

  • Reports 6 - Attached Libraries.

    Am currently developing a report using Oracle Report Builder 6.0 - which has an attached library containing a specific program unit. When compiled on my machine (win2000), no errors are encountered.
    But during runtime, we receive the error "ORA-06508 PL/SQL Could not find program unit being called". Have tried re-attaching the library then re-compiling and do not anticipate any issues regarding Windows platforms as we're all on Win2000. Could there be a .dll mismatch?
    I do have a work-around for this by making the procedure that is used from the library a local Program Unit and just calling it as per normal.
    The only other info I have is that this report has been upgraded from a forms 4.5 platform.
    Any sensible ideas will be gratefully received.

    Are you running the rdf or rep? Also is your runtime environment at the same patch level as the design environment (i.e, are both the version numbers the same?)
    Thanks,
    Danny

  • Import presets from previous version

    Having upgraded from CS to CS4 I want to import my preset crops and brushes into the new version. I can't find any advice elsewhere and would appreciate it if someone could please tell me how to do this.
    Roger

    Thanks again. You prompted me to save my CS presets in Edit>Preset Manager>Save Set. This puts them into folders under C/Program Files/Adobe/Photohop CS/Presets/Brushes [/Tools] from where they can be copied and pasted into the corresponding CS4 folders. Then it is necessary to activate them by double-clicking the set in the Brushes folder [or from the Load Set command in the CS4 Preset Manager in the case of Tools] and, hey presto, they appear under the right tool buttons.
    I don't know if I've done it the right way because I had to create Brushes and Tools subfolders in the CS4 Presets folder. My saved brush set does not show up under Load Set in the CS4 Preset Manager but the saved crop tools do, making the procedure different for each. To me that's all very weird but everything seems to be working OK.
    Roger

  • Best issue : using SDO_GEOMETRY in dotnet application

    Hi,
    I would like to use oracle spatial in my application.
    I h'ven't any experience about using oracle spatial in dotnet application.
    What's the best way ?
    Using XMLcommand for making spatial request and deserialize result ?
    Making stored procedure returning primitive types (int, string, bool, ...)
    Another way ?
    regards,

    Hi,
    There is currently no support in ODP.NET for SDO_GEOMETRY. I've not had an official response from any Oracle staff, but I've asked a few Oracle trainers and presenters and they all said that they didn't know of any plans to add this.
    That said, you can call PL/SQL procs from .NET which you can use to manipulate/create geometries (as you suggested). What you can't do is read sdo_geometry data into a .NET datatype.
    If you really need to get geometry data into .NET, you could try selecting the various sdo_geometry fields as separate columns and try and select them into varrays etc. and from there into .NET types. I've not tried this myself, but it should be possible.
    e.g.
    select
    a.geom.gtype,
    a.geom.srid,
    a.geom.sdo_ordinates
    from
    some_table a;
    Note: You have to alias the table name like this in order to select separate sdo_geometry fields. No idea why.
    I've not tried using XML for this. I'd be interested to know if that works.
    Good luck,
    Jeremy

  • RECOVERY G6-2278DX

    Hello, I have a g6-2278DX notebook came with Windows 8 installed, due to some virus needed to format it, so that when making the procedure of just deleting the partition recovery, now I have the laptop with no operating system and can not used it.
    I need your help, is there any chance of getting a download or a new file recovery to be able to turn the notebook in its original factory state.
    I await contact, thank you!

    If you did not create your Recovery Media before formatting you will have to call HP Support to order.
    If you live in the US or CA, contact HP Here.
    If you live in another part of the world, start here>>Contact HP
    ******Clicking the Thumbs-Up button is a way to say -Thanks!.******
    **Click Accept as Solution on a Reply that solves your issue to help others**

Maybe you are looking for

  • Logic 9 corrupts EXS insts created/edited in Logic 8

    OK, I thought this issue was limited only to EXS instruments that used the VSL Performance Tool, but I'm finding that many (if not all) instruments I created or edited in Logic 8 are corrupted in Logic 9. Something fishy is going on in the EXS archit

  • Why can't I get a pdf document to print in color?

    I am going to school online and I need to print a pdf document that my instructor had me download from my online classroom.  I can get the pdf to print in grayscale but I can't get it to print in color.  It doesn't have anything to do with my printer

  • Business Rules Unavailable

    I am unable to gain access to the CAPEX module predefined business rules. I've updated shared services allowing the selected user user rights to planning and business rules. However, they still do not show up in workspace. For instance: I'm using For

  • Adobe premiere pro cc 2014 freezing with magic bullet looks

    Hi- I'm running windows 8 with this software and I'm getting intermittent crashing when trying to work on any project when I'm also using magic bullet Looks on it.  The frustrating thing is that it used to work fine in premiere Pro CC, but using the

  • Editing SQL Query

    Post Author: Sbaptista CA Forum: Data Connectivity and SQL Hi All.  I'm new to CR10, and have many reports created in CR8.5.  However, when I open these reports in CR10, I cannot edit the SQL Query... it is completely greyed out.  To add fuel to the