Need PL SQL Procedure

Hello All,
I like to write a PL SQL Procedure for the below sql statements. I like to pass all values from first sql stmnt to update columns in second sql stmnt based on dund_cc that is selecting from first sql stmnt. Please help me out how can I put together in pl sql procedure.
SELECT Y.DUND_CC, Y.DPPROP, Y.APPNMENT, Y.ALLOTMENT, Y.ALLOCATION, Y.BDGCT FROM ABCDX_TBL Y;
UPDATE POSDGET b SET B.DPPROP = Y.DPPROP, b.APPNMENT = Y.APPNMENT, b.ALLOTMENT = Y.ALLOTMENT,
b.Y.ALLOCATION = Y.ALLOCATION WHERE b.DUND_CC = Y.DUND_CC;
Thanks in Advance!!!

Hi,
You don't need a stored procedure or PL/SQL to do that. You can use a single UPDATE or MERGE statement, like this:
MERGE INTO       posdget     dst
USING   (
           SELECT  dund_cc
        ,        dpprop
        ,        appnment
        ,        allotment
        ,        allocation
        ,        bdgct
        FROM        abcdx_tbl
        )               src
ON     (src.dund_cc     - dst.dund_cc)
WHEN MATCHED THEN UPDATE
SET     dst.dpprop     = src.dpprop
,     dst.appnment     = src.appnment
,     dst.allotment     = src.allotment
,     dst.allocation     = src.allocation
;The statement above will also work in PL/SQL, if you have a reason for doing it that way.

Similar Messages

  • I need PL/SQL Procedure

    Hi,
    I want to wirte a procedure for loading data from oracle into multiple worksheets in Excel. kindly help me.
    I need only pl/sql procedure.
    Thanks
    Balaji

    http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:18304995040582

  • Need Pl/sql Procedure Only

    Hi,
    I have a data in excel CSV file,it has multiple pages (example 3 pages),presently i'm loading data into oracle one by one by manually instead of this , want to write a pal/sql procedure to automatically load data from all pages in that CSV file.
    Kindly help me
    Thank you

    http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:18304995040582

  • Need PL/SQL procedure for file transfer local system to server location

    Hi Experts,
    The requirement is one file ex: text file,excel file is there in Local system suppose c:newfolder/test.txt.
    once run the concurrent program for this particular file in the local system should transfer into server location for the mentioned path.
    is it possible to do in PL/SQL or shell script.
    can you please share the code.
    Thanks
    Meher

    Meher Irk wrote:
    The requirement is one file ex: text file,excel file is there in Local system suppose c:newfolder/test.txt.
    once run the concurrent program for this particular file in the local system should transfer into server location for the mentioned path.Why do you want to copy a local file from the local client file system, via the Oracle database server, to a remote directory on the server?
    Why is the Oracle database server to be used? For what purpose?
    There are standard secure methods for a client to copy a file to a server. Such as sftp and scp. No complex Oracle database server layer needed in-between.
    So why do you want to use the Oracle database to act as the copy mechanism for you?
    It will only make sense if the local file is copied into the database (as a LOB or securefile) and managed by the database. I fail to see why Oracle should be acting as the go-between for the client file system copy process to the server file system. This introduces another moving part in the copy process. Adds more security issues. Adds more authentication issues. And what for?

  • Need to wite pl sql procedure for dynamic select statement

    Need pl sql procedure for a Dynamic select statement which will drop tables older than 45 days
    select 'Drop table'||' ' ||STG_TBL_NAME||'_DTL_STG;' from IG_SESSION_LOG where substr(DTTM_STAMP, 1, 9) < current_date - 45 and INTF_STATUS=0 order by DTTM_STAMP desc;

    I used this to subtract any data older than 2 years, adjustments can be made so that it fits for forty five days, you can see how I changed it from the originaln dd-mon-yyyy to a "monyy", this way it doesn't become confused with the Static data in the in Oracle, and call back to the previous year when unnecessary:
    TO_NUMBER(TO_CHAR(A.MV_DATE,'YYMM')) >= TO_NUMBER(TO_CHAR(SYSDATE - 365, 'YYMM'))

  • Need help in writing a tricky sql/PL/Sql Procedure

    Hi,
    I have a Branch table with just two fields in it node1 and Node2, The table looks like this
    node1 | node2
    -------|---------
    1 | 2
    3 | 2
    3 | 4
    4 | 5
    1 | 5
    1 | 6
    5 | 6
    in the above data if you draw lines between node_1 and node_2 you will see that there are 3 different paths to get from 1 to 5, as follows
    /--------6-------\
    1----------------------5
    \2------3-------4/
    Now I need to Find all the nodes between 1 and 5 or all the possible paths from node 1 to node 5 in this case I have 3 possible paths they are as follows
    1-2-3-4-5
    1-3-5
    1-5
    Now I know if this data was stored in a hierarchical manner I can get the results i want by using CONNECT BY and SYS_CONNECT_BY_PATH.
    Is there a way to transform this data into a hierarchcal manner so that I can use the CONNECT BY or can somebody give me an Idea as to how to write a PL/SQL procedure to get the result I want.
    Any help will be greatly appreciated

    Hi!
    1.Create another table Branch1 to hold 'transformed data'.
    2.Use the following procedure to insert data into branch1 table.
    declare
    cursor n is select * from branch;
    begin
    for nrec in n loop
    if nrec.node1 = 5 then
         insert into branch1(node1,node2) values(nrec.node2,nrec.node1);
    elsif nrec.node2= 5 then
         insert into branch1(node1,node2) values(nrec.node1,nrec.node2);
    else
    if      nrec.node2> 5      then
         insert into branch1(node1,node2) values(nrec.node1,nrec.node2);
    elsif nrec.node1> 5 then
         insert into branch1(node1,node2) values(nrec.node2,nrec.node1);
    elsif (nrec.node1 < nrec.node2 ) then
         insert into branch1(node1,node2) values(nrec.node1,nrec.node2);
    else
         insert into branch1(node1,node2) values(nrec.node2,nrec.node1);
    end if;
    end if;
    end loop;
    commit;
    end;
    3.Then execute the following connect by query:
    SQL> select lpad(' ',level*2,' ')||node1 from branch1
    2 start with node1=1
    3 connect by prior node2=node1;
    Hope this is satisfactory.
    Thanks!

  • How to call a PL/SQL procedure from a xml Data Template

    We have a requirement in which we need to call a pl/sql package.(dot)procedure from a Data Template of XML Publisher.
    we have registered a Data Template & a RTF Template in the XML Publisher Responsibility in the Oracle 11.5.10 instance(Front End).
    In the Data Query part of the Data Template , we have to get the data from a Custom View.
    This view needs to be populated by a PL/SQL procedure.And this procedure needs to be called from this Data Template only.
    Can anybody suggest the solution.
    Thanks,
    Sachin

    Call the procecure in the After Parameter Form trigger, which can be scripted in the Data Template.
    BTW, there is a specialized XML Publisher forum:
    BI Publisher

  • How to secure a PL/SQL procedure that is called from the web browser

    If you have ever seen the sample document management application, and tried to download a file that was stored in the system, you are probably familiar with the apex_util.count_click URL that is used to download the file. If you copy that URL and paste it into a new browser, you will not be prompted to login to download the requested file. I'm using SSO with Apex as a partner application. How can I secure a pl/sql procedure like this to redirect to the login page before beginning the download?
    Thanks,
    Kris

    You can use the second method described here:
    http://apex.oracle.com/pls/otn/f?p=31517:15
    You would use an application process instead of pasting the procedure call in the browser. In the case I describe, you don't need to grant execute to public on the download procedure.
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.opal-consulting.de/training
    http://apex.oracle.com/pls/otn/f?p=31517:1
    -------------------------------------------------------------------

  • How to pass multiple parameters while calling a pl/sql procedure based serv

    Hi,
    I have a pl/sql procedure based service that needs to be invoked from the bpel console for testing purpose. This procedure accepts multiple input values which are of varchar2,boolean and datetime data types. How can I get the bpel console to throw a UI where I can enter these values --in other words where(which file and where) can I specify that these are the input parameters that need to be entered along with their types.
    Thanks for yr help!

    Change the payload of the request 'Process WSDL' message type. Change the element of the payload for the RequestMessage to be 'InputParameters' from the XSD generated by the DB Adapter wizard.
    Edit the payload (Element) - Choose 'Project Schema Files'. Select 'InputParameters' from the XSD.
    You can also change the ResponseMessage by doing the same thing, except that you select 'OutputParameters' from the XSD.

  • Call an applications 'user exit' from a PL/SQL procedure

    My question is a technical PL/SQL question related to Oracle Applications. I need to call a standard applications 'user exit' from a stored PL/SQL procedure. Can anyone tell me if this is possible and how to do it?
    (i.e. I am attempting to call the AR user exit SALESTAX)
    Thanks,
    Michelle Dodge

    Hi,
    Read this thread, perhaps is there your response :
    Host...
    Nicolas.

  • Creating a CSV file from a pl/sql procedure

    Hi Everyone,
    I would like to know how to write a procedure in pl/sql where i need to check if they are any records in a table say "Table A".
    If they are any records in the "Table A" then we need to write those records in the "Table A" to the CSV file.
    If they are no records then we need to insert a record into the CSV file that "No records are found in "Table A".
    Could anybody please help ?
    Thanks in advance

    see this
    ops$tkyte@8i> create or replace procedure dump_table_to_csv( p_tname in varchar2,
    2 p_dir in varchar2,
    3 p_filename in varchar2 )
    4 is
    5 l_output utl_file.file_type;
    6 l_theCursor integer default dbms_sql.open_cursor;
    7 l_columnValue varchar2(4000);
    8 l_status integer;
    9 l_query varchar2(1000)
    10 default 'select * from ' || p_tname;
    11 l_colCnt number := 0;
    12 l_separator varchar2(1);
    13 l_descTbl dbms_sql.desc_tab;
    14 begin
    15 l_output := utl_file.fopen( p_dir, p_filename, 'w' );
    16 execute immediate 'alter session set nls_date_format=''dd-mon-yyyy hh24:mi:ss''
    17
    18 dbms_sql.parse( l_theCursor, l_query, dbms_sql.native );
    19 dbms_sql.describe_columns( l_theCursor, l_colCnt, l_descTbl );
    20
    21 for i in 1 .. l_colCnt loop
    22 utl_file.put( l_output, l_separator || '"' || l_descTbl(i).col_name || '"'
    23 dbms_sql.define_column( l_theCursor, i, l_columnValue, 4000 );
    24 l_separator := ',';
    25 end loop;
    26 utl_file.new_line( l_output );
    27
    28 l_status := dbms_sql.execute(l_theCursor);
    29
    30 while ( dbms_sql.fetch_rows(l_theCursor) > 0 ) loop
    31 l_separator := '';
    32 for i in 1 .. l_colCnt loop
    33 dbms_sql.column_value( l_theCursor, i, l_columnValue );
    34 utl_file.put( l_output, l_separator || l_columnValue );
    35 l_separator := ',';
    36 end loop;
    37 utl_file.new_line( l_output );
    38 end loop;
    39 dbms_sql.close_cursor(l_theCursor);
    40 utl_file.fclose( l_output );
    41
    42 execute immediate 'alter session set nls_date_format=''dd-MON-yy'' ';
    43 exception
    44 when others then
    45 execute immediate 'alter session set nls_date_format=''dd-MON-yy'' ';
    46 raise;
    47 end;
    48 /
    Procedure created.
    ops$tkyte@8i> exec dump_table_to_csv( 'emp', '/tmp', 'tkyte.emp' );
    PL/SQL procedure successfully completed.

  • Execute CDC mappings from a PL/SQL procedure

    Hi,
    I´m using OWB 11.2.0.2 for Linux. I´ve created some CDC mappings to update cubes with changes coming from other tables and cubes (from the tables that implement those cubes with the relational option). The issues are:
    - The CDC mappings run successfully from the OWB (Project Navigator - Start), but I cannot execute them from a procedure in PL/SQL with the following code:
    PROCEDURE "PROC_RUNCDCMAPPINGS" IS
    --inicializar variables aquí
    RetVal NUMBER;
    P_ENV WB_RT_MAPAUDIT.WB_RT_NAME_VALUES;
    -- ventana principal
    BEGIN
    RetVal:= BARIK.CDC_LOAD_CUBO_RECARGA.MAIN(P_ENV);
    RetVal:= BARIK.CDC_LOAD_CUBO_TOR.MAIN(P_ENV);
    RetVal:= BARIK.CDC_LOAD_CUBO_TOAE.MAIN(P_ENV);
    RetVal:= BARIK.CDC_LOAD_CUBO_VIAJES.MAIN(P_ENV);
    RetVal:= BARIK.CDC_LOAD_CUBO_TICKETINCIDENCIA.MAIN(P_ENV);
    RetVal:= BARIK.CDC_LOAD_CUBO_LIQMONEDERO.MAIN(P_ENV);
    RetVal:= BARIK.CDC_LOAD_CUBOS_LIQTEMPORALES.MAIN(P_ENV);
    COMMIT;
    END;
    It doesn´t report any error (the value for RetVal after execution is 0), but the cubes are not loaded with changes, and the changes stored in the J$_%tables are not consumed.
    Some of the options that may impact in the mappings are:
    - All the CDC are of Simple type
    - There are more than one subscriber to consume the changes, as for some tables, its changes must feed more than one CDC.
    - All the mappings include only one execution unit per mapping.
    - The integration/load template is the default: DEFAULT_ORACLE_TARGET_CT
    Other question is: As I explained, I need more than one subscriber because same updates must be consumed by different CDC mappings, to load different cubes, but I´ve not been able to assign the subscribers to only the tables associated with them, so all the subscribers are subscribed to all the changes in all the CDC tables, but as many of those subscribers never consume the changes of same tables, in the J$_% tables remains the not consumed records, and I haven´t found the way to purge those tables (other than the delete from J$_), nor to assign the tables with the subscribers (so the subscribers are only subscribed to their interested changes, that will be consumed, so the tables will be emptied after the consumption).
    Any help with these problems will be greatly appreciated.
    Tell me if more info is needed to clarify the situation.
    Best regards,
    Ana

    Hi David,
    Thank you for your reply.
    These mappings are the mappings needed to update the cubes with the changes detected by the CDC system, they are located under the Mapping Templates folder and I´m using code templates for the control of the loading and the integration (the DEFAULT_ORACLE_TARGET_CT) mapping.
    What I need is to execute these mappings within a PL/SQL procedure that will be invoked from different tools.
    I´ve done it for regular mappings (not CDC mappings), and it works. The code is the same as for the CDC ones:
    PROCEDURE "PROC_RUNLOADMAPPINGS" IS
    --inicializar variables aquí
    RetVal NUMBER;
    P_ENV WB_RT_MAPAUDIT.WB_RT_NAME_VALUES;
    -- ventana principal
    BEGIN
    RetVal:= BARIK.LOAD_CUBO_RECARGA.MAIN(P_ENV);
    RetVal:= BARIK.LOAD_CUBO_TOR.MAIN(P_ENV);
    RetVal:= BARIK.LOAD_CUBO_TOAE.MAIN(P_ENV);
    RetVal:= BARIK.LOAD_CUBO_VIAJES.MAIN(P_ENV);
    RetVal:= BARIK.LOAD_CUBO_TICKETINCIDENCIA.MAIN(P_ENV);
    COMMIT;
    END;
    -- End of PROC_RUNLOADMAPPINGS;
    ,and when I run it, the mappings are executed, but with the CDC ones it doesn´t (even when no error is reported).
    I know that they are deployed in the selected agent (in my case the Default_Agent), but when I start them from the OWB, the mapping packages are created in the DB schema, so, I thought that maybe I could invoke them....so what you tell me is that the only way to invoke them is from SQL*Plus? not from a regular PL/SQL procedure?
    Thank you very much,
    Ana

  • Basic Report Run from a PL/SQL Procedure

    I am hosed trying to start a BI Publisher report from a PL/SQL procedure. Basically, I have a procedure with a local variable defined as an XMLType. I need to call an RTF source, pass the xmlfile in and tell the RTF Engine where to send the output.
    The users guide implies that it involves calls to a Java program and I am totally ignorant of Java.
    I have successfully linked the RTF source into the XML_Publisher application and previewed it against a known data set. hat works.
    So, if I have a PL/SQL package with the local variable L_XML defined as XMLTYPE
    and an output file L_OUTBUT defined as VARCHAR2(100), what do I use to call the RTF Processor and generate the report to the output file?
    That is
    declare
    l_xml xmltype;
    l_output varchar2(100);
    begin
    -- stuff to build the xml variable
    -- insert the call to FTP Processor here Apparently, it should be
    -- something like
    package.procedure('linked_rtf file name', l_xml, l_output);
    end;
    If this calls a Java script, would also appreciate a sample copy of the script.
    My need is desperate so any assistance will be greatly appreciated.
    Many thanks
    Frank

    I don't think you can. The parameters passed to a VB dll are formatted differently than a C dll, especially strings. I know a C program has to use special data structures when working with a VB dll, and this is basically what Oracle is doing.
    It should be possible, however, to create a C dll that acts as a wrapper for the VB dll. I'm not sure this would save you anything, though. If you have to do that you may as well write the function in C.

  • How to pass variable to content area from a PL/SQL procedure

    Hi,
    Can somebody tell me how to create a(Content area) folder based on a PL/SQL procedure that takes a variable as a
    parameter and returns data based on value of that parameter to the folder . Any help would be appreciated .
    Thanks and regards.
    Neeti.

    Somewhere, in one procedure, build a session identifier and save your variable there. If no session with that identifier is previously stored, it will create a new session instance with that ID for you.
    declare
    l_sess portal30.wwsto_api_session;
    varvalue number;
    begin
    varvalue := 100;
    l_sess := portal30.wwsto_api_session.load_session('MYSESSION','VARIABLES');
    l_sess.set_attribute('VAR_NAME',varvalue);
    l_sess.save_session;
    end;
    In your other procedure, or anywhere else needed within that same session, simply load the session and reference the variable. To reference the variable, use the following.
    -- assuming new procedure, so re-defining session variable and reloading session into it
    declare
    my_session portal30.wwsto_api_session;
    my_new_variable number;
    begin
    my_session := portal30.wwsto_api_session.load_session('MYSESSION','VARIABLES');
    my_new_variable := my_session.get_attribute_as_number('VAR_NAME');
    end;
    This will let you reference parameters across multiple portal applications and indirect calls.

  • How to start a report on the reports server from a pl/sql procedure

    I would like to start or queue a report on the reports server / cartridge from within a serverside pl/sql procedure along with passing report parameters.
    Can I use the package utl_http and if yes, how?
    null

    Hi,
    Before this you have to prepare your internal table with tab delimeter structure with data.
    data: wa_appl_title like line of appl_title.
           concatenate fhdr '/file_details_'
                        sy-datum '_' sy-uzeit '.txt' into fhdr.
    *MOD01 - start.
           open dataset fhdr for output in text mode." ENCODING DEFAULT.
            open dataset fhdr for output in text mode ENCODING DEFAULT.
    *MOD01 - end.
            if sy-subrc = 0.
              clear wa_appl_title.
              read table appl_title into wa_appl_title index 1.
              if sy-subrc = 0.
                transfer wa_appl_title to fhdr.
              endif.
              loop at appl_it.
                transfer appl_it to fhdr.
              endloop.
              close dataset fhdr.
              write: / text-t05.
            else.
              write: /  text-t04.
            endif.
    After this you view in AL11 tranx.
    let us know any thing else you need.
    Thanks,
    Deepak.

Maybe you are looking for

  • PO release based on Classification

    Dear Experts, Hi experts, Our team has configured PO release procedure, in that they used Order type(BSART) and Material Group (MATKL) as the characteristics for the Class that is used for that group. FYI in the system there is only one Release group

  • Open url, type in a form and repeat in safari

    I'm very new to scripting so bare with me. I'm trying to open a url, select a form or dialogue box ( not sure what they're called) enter text into it, click the submit button, and repeat in a set number of minutes. So far I've been able to open a win

  • Quiz Results Screen

    Is there a way to modify what fields appear in the quiz result screen?  I have a project built from 4 other projects.  At the end of each project I have review questions.  I marked these as survey because I didn't want the results reported to an LMS.

  • Syncing pictures

    I have always used my Ipod Touch for just a few apps but mainly to have a very portable way of viewing my 26 gb worth of pictures - about 54K pictures - (which I have always successfully synced from my Pictures folders). Upgraded to iOS 5 so lost the

  • Firefox crashes or runs but with splotches missing color, how do i fix it?

    when I start firefox my desktop starts flashing on and off and when it returns there are splotches missing color. firefox then either crashes or runs but with the colors muted and images distorted.