Granting privilege through role not working for PL/SQL

Version: 11.2.0.2
In our shop, we don't grant privileges directly to a user, we grant it to a role and grant that role to the intended grantee.
Granting privileges through a role seems to be fine with SQL Engine. But it doesn't work from PL/SQL engine.
In the below example GLS_DEV user is granted SELECT access on SCOTT.pets table through a role called tstrole. GLS_DEV can select this table from SQL. But PL/SQL Engine doesn't seem to know this.
Reproducing the issue:
SQL> show user
USER is "SCOTT"
SQL> select * from pets;
NAME
PLUTO
SQL> conn / as sysdba
Connected.
SQL> create user GLS_DEV identified by test1234 default tablespace TSTDATA;
User created.
SQL> alter user GLS_DEV quota 25m on TSTDATA;
User altered.
SQL> grant create session, resource to GLS_DEV;
Grant succeeded.
--- Granting SELECT privilege on scott.pets to tstrole and then grant this role to GLS_DEV.
SQL> conn / as sysdba
Connected.
SQL>
SQL> create role tstrole;
Role created.
SQL> grant select on scott.pets to tstrole;
Grant succeeded.
SQL> grant tstrole to GLS_DEV;
Grant succeeded.
SQL> conn GLS_DEV/test1234
Connected.
SQL>
SQL> select * From scott.pets;
NAME
PLUTO
---- All fine till here. From SQL engine , GLS_DEV user can SELECT scott.pets table.
--- Now , I am going to create a PL/SQL object in GLS_DEV which tries to refer scott.pets
SQL> show user
USER is "GLS_DEV"
create or replace procedure my_proc
is
myvariable varchar2(35);
begin
     select name into myvariable from scott.pets ;
     dbms_output.put_line(myvariable);
end my_proc;
Warning: Procedure created with compilation errors.
SQL> show errors
Errors for PROCEDURE MY_PROC:
LINE/COL ERROR
6/2      PL/SQL: SQL Statement ignored
6/41     PL/SQL: ORA-01031: insufficient privileges
SQL>
SQL> 6
  6*    select name into myvariable from scott.pets ;
--- PL/SQL Engine doesn't seem to know that GLS_DEV has select privilege on scott.pets indirectly granted through a role
--- Fix
--- Instead of granting privilege through a role, I am granting the SELECT privilege on scott.pets to GLS_DEV directly.
--- The error goes away, I can compile and execute the procedure !!
SQL> conn / as sysdba
Connected.
SQL>
SQL> grant select on scott.pets to GLS_DEV;
Grant succeeded.
SQL> conn GLS_DEV/test1234
Connected.
SQL>
SQL> create or replace procedure my_proc
is
myvariable varchar2(35);
begin
        select name into myvariable from scott.pets ;
        dbms_output.put_line(myvariable);
end my_proc;  2    3    4    5    6    7    8    9   10
11  /
Procedure created.
SQL> set serveroutput on
SQL> exec my_proc;
PLUTO
PL/SQL procedure successfully completed.Has anyone encountered the same issue ?

You really should start your own new thread for this question instead of resurrecting an old one, but to answer your question.
There are two things going on here. First, there are a number of aler session commands that can be used by any user regardless of what privileges they are granted. Although I do not have the entire list at hand, things like nls_date_format and current_schema are available to all users, sort of like the grants to public in the data dictionary.
Second, when you use execute immediate, the PL/SQL engine never really sees the statement, as far as the compiler is concerned it is just a string. It is only when the string is passed to the sql engine that permissions are checked, and there roles are not enabled.
SQL> create role t_role;
Role created.
SQL> grant select on ops$oracle.t to t_role;
Grant succeeded.
SQL> create user a identified by a default tablespace users;
User created.
SQL> grant create session, create procedure to a;
Grant succeeded.
SQL> grant t_role to a;
Grant succeeded.
SQL> connect a/a
Connected.
SQL> select * from ops$oracle.t;
        ID DESCR
         1 One
         1 Un
SQL> create function f (p_descr in varchar2) return number as
  2     l_num number;
  3  begin
  4     select id into l_num
  5     from ops$oracle.t
  6     where descr = p_descr;
  7     return l_num;
  8  end;
  9  /
Warning: Function created with compilation errors.
SQL> show error
Errors for FUNCTION F:
LINE/COL ERROR
4/4      PL/SQL: SQL Statement ignored
5/20     PL/SQL: ORA-00942: table or view does not exist
SQL> create or replace function f (p_descr in varchar2) return number as
  2     l_num number;
  3  begin
  4     execute immediate 'select id from ops$oracle.t where descr = :b1'
  5                       into l_num using p_descr;
  6     return l_num;
  7  end;
  8  /
Function created.
SQL> select f('One') from dual;
select f('One') from dual
ERROR at line 1:
ORA-00942: table or view does not exist
ORA-06512: at "A.F", line 4John

Similar Messages

  • Custom Auto Attendant Prompts through TUI not working for users who migrated from 2010 to 2013

    In Exchange 2010, we started using unified messaging and set up Auto Attendants. We setup a admin role/RBAC for people of a security group to be able to update the message on the auto attendants. They have the UMPrompts assigned role. All of this is working
    great in 2010. We have now migrated to 2013, and the users who were migrated from 2010 to 2013 can no longer update the messages through TUI. Newly created 2013 users can and are assigned the EXASCT same permission as the users who have been doing this for
    well over a year on 2010.  When they call the AA and press #,* they are asked to provide their extension, after doing so the system tells them that extension is not correct. and asks for the extension again.  Newly created users with the same permissions
    get prompted for their PIN and can log in and change the message just fine. 
    Confirmed Bug?  anybody else having this issue?
    What would be different for this process between a user who was migrated from a previous version like 2010 compared to a newer user who has only ever existed on 2013?

    What if the migrated 2010 users are in the same DB as the system mailbox? I had a similar issue during a migration; http://www.skypeadmin.com/2014/11/10/known-issue-um-automated-attendant-tui-editing-broken-migration/
    Please remember, if you see a post that helped you please click "Vote As Helpful" and if it answered your question please click "Mark As Answer".
    SWC Unified Communications
    This forum post is based upon my personal experience and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.

  • Drill Through report not working for large data

    Hi,
    In SSRS 2008 R2, I have a main report and a drill through report from one of the main report's column. The drill through report works mostly except if the data is too large i.e. more than 1 million records. How to fix this problem?
    Thanks,
    Jkrishna

    Nope. WHat I meant was not to show the entire data in child report (ie your 1 million records). Instead add extra parameter as PageNumber. By default set it as 1 when you navigate to child report (default value)
    Then in query behind use a ROW_NUMBER based logic like below
    SELECT *
    FROM
    SELEC ROW_NUMBER() OVER (ORDER BY <combination of unique valued column(s)>) AS Rn,...
    Your existing query other columns
    )t
    WHERE Rn BETWEEN ((@PageNo-1) * 1000) + 1 AND @PageNo * 1000
    Assuming you want 1000 per page
    So when it renders it will show first 1000 records. Add a NextPage icon to report footer and when clicked add a jump to report functionality to same report but with PageNumber parameter value as
    =Parameters!PageNumber.Value + 1
    and it will then give you second page data etc 
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Webauth redirect through WLC not working for Mac OSX

    We have a WLC5508 setup to redirect guest users to an ISE for web authentication. We configured the Flexconnect ACL's and external authentication. It works when using Internet Explorer on a PC, or when connecting from a IOS device (iPad, iPhone). When trying to connect from a Macbook Pro or Macbook Air, I get prompted with the guest portal to login, I type in my credential, then I see a window pop up that is attempting to launch the redirect window. That window never fully comes up. I get prompted about the certificate being from an unsigned authority, and I select to trust always. If I disconnect and try reconnecting, I get the same problem.
    Any ideas on why this would be specific to OSX?

    I had a case where I wanted to set something similiar up I just wanted "passthrough" (discaimer page) L3 security instead of some radius authentication.
    If the WLC doing the authentication is an "Anchor" WLC, then the only L3 security setting that works is the "Authentication" under "WLAN->SSID->Security tab->Layer 3" tab and enabling web-policy. Since I don't know if you use an anchor WLC I can't say if you have the same problem as I did.
    I got this information from
    http://www.cisco.com/en/US/docs/wireless/controller/7.2/configuration/guide/cg_mobility.html#wp1233539 maybe you have somthing there that can help.

  • Function Module not working for old Role

    Dears
    Function Module not working for old Role
    Function Module: /VIRSA/BAPI_AE_USERS_FOR_ROLES
    Before EHP4 upgrade this functional module working fine, but after updated users are not visible.
    We have chekced if the users are assigned directly users are visible but indirect (Position Based) assignment users are not apprearing.
    Pl check the fucntion module with given roles below and identify the root cause,
    EP_TRVL_ALL_CAB     - Old Role
    EP_TRN_TRVL_DRGC_V2 - New Role
    Regards
    Krishna Mohan CH
    9704500717

    Krishna,
    I do not think this BAPI is meant to be called by anyone but the application using it, and its functionality may therefore change without notice.
    What are you trying to achieve? Maybe there's a better way to do that...
    Frank.

  • Transaction launcher not working for custom business role

    Hi Experts,
    I am facing a very weird problem where the transaction laucher define for BOR transaction is working for one business role(Z business role Customized one) but its not working for other business role (Z business role).
    to emphasize further we have the code:-
    case ls_attributes-object_type.
        when lc_z23 or lc_z25.
          lv_logical_link = lc_ZITISU.
        when lc_BUS2000115.
          lv_logical_link = lc_ZITERP1.
        when others.
          lv_logical_link = lc_ZITERP2.
      endcase.
      l_if_navigation = cl_crm_ui_navigation_service=>get_instance( me ).
      IF l_if_navigation IS BOUND .
    Navigate to transaction launcher using link id
        l_if_navigation->navigate( iv_link_id = lv_logical_link ).
      ENDIF.
    in this the logical link is is lc_ZITISU whenever this BSP application is called from both the business roles but in  one the window opens up for BOR transaction whereas when we login again using different business role the code is the same as given above. I mean the sam logical link id is used and navigated to but window is not opening for transaction launcher as it happens for the previous business role.
    Request your help to resolve this issue.
    Thanks,
    Rajwin

    Hi,
    I tried by applying the PFCG role id of business role which was working to the business role id of the one for which it wasn't working and then try testing whether the transaction launcher is triggering. But the transaction launcher screen is still not opening even after doing this.
    Probably there's something else too which is causing the problem. Request your inputs on this,
    Thanks,
    Rajwin

  • My htc-phone provides internet facility through cable/blue-tooth to my windows notebook. It does not have a wifi or hotspot facility.  Can the same internet through blue-tooth work for ipad2.

    My htc-phone provides internet facility through cable/blue-tooth to my windows notebook. My htc-phone does not have a wifi or hotspot facility.  Can the same internet through blue-tooth work for ipad2?

    No, the bluetooth profile in the iPad does not provide that
    capacity. Can your netbook be a wifi transmitter? If yes,
    you can connect to the internet via htc-phone and pass
    the connection to the netbook which will connect via wifi
    to iPad. I am not familiar with the hardware in netbooks nor
    the capabilities of Windows, so what I am suggesting looks
    good in theory but the reality may not allow it. Still worth
    checking into.

  • Software Update Point Switching is not working for some Clients

    Hi there,
    I found nothing similar here and I hope this is the right section.
    I´m running ConfigMgr 2012 R2 where one of the Site Systems from one of the Primaries is located in an untrusted Forest in a perimeter Network. The Site System there has the MP, SUP and DB Roles. In general it works great. The Systems in that untrusted Forest
    get the SCCM Agent pushed, see and can install published Software packages and receive Windows Updates. But there are a few systems where everything works, except Windows Updates.
    So I had a deeper look at what is happening and found out that the SUP switching is not working for them. They always try to contact the SUP from the Primary, which they cannot reach (this is intended).
    From how I understand SUP switching as described here
    http://blogs.technet.com/b/configmgrteam/archive/2013/03/27/software-update-points-in-cm2012sp1.aspx#pi140062=1
    the Windows Update Agent tries to connect to a SUP every 30 minutes and after 4 failed attempts he will try to connect to the next one until he finds one which works.
    As I said before, this seems to work for most systems in the untrusted forest, but some do not make any intentions to switch the SUP.
    So my next step was to find out from where the Update Agent can get the information of the available SUPs. I think they either don´t receive the information that other SUPs exist, or if the Information is there, they don´t realize that there´s an error and
    make no attempt to switch.
    I used the System Center Support Center to gather all Information from some of the systems with that problems (Log Files, WMI information, registry information, policies etc.) but I cannot find where SCCM or the Update Agent store the information which SUPs
    are available in my environment.
    I´m sure the problem is on the Systems which fail to connect to the right SUP and not in the SCCM infrastructure itself, because for most of the systems everything is working just perfect. Unfortunately in the Blog Post above there´s also no information
    where this information is stored and how it is obtained by the clients. In the comments there´s even one post which describes the same problem I have here, but there was no answer. I hope someone can point me into the right direction, because I´m stuck currently.
    Things I tried additionally to all the log file / WMI / registry sniffing:
    Removing the Software Distribution Folder and restarting the Windows Update Agent
    Removing the WindowsUpdate Registry folder in the HKLM\SOFTWARE\Policies\Windows section in the Registry and restarting the Windows Update Agent.
    Tried to reset the WUAgent with wuauclt /Resetauthorization additionally to the steps above.
    I also tried to manually set the WUServer and WUStatusServer Keys in the registry to the new Server, but as soon as the next Update Scan cycle runs, the value is set back to the URL of the Primary Sites SUP
    Is someone having additional ideas? It seems to me older systems are more affected (which were configured for a standard WSUS before SCCM 2012 was deployed) than newer ones which were installed when SCCM was in place already. But I don´t know what else to
    "reset" on those machines without reinstalling them.

    Thank you very much for your response. I must have missed that one by looking through numerous Logfiles. In this, there´s indeed a list of all available SUPs. So according to the LocationServices.log the machine should have a choice.
    The WMI Key however, contains just one entry and this is the URL of the Primaries SUP which is not reachable in the untrusted forest. Is it OK that the WMI entry includes only one entry? If yes, what process is putting the results from the LocationServices
    into WMI? It seems like the Windows Update Agent is feeded from the WMI Key then. If this is the case my problems seems to be the "communication path" between these two components.
    Is this the job from the SCCM Agent, the Windows Update Agent or maybe some third component I´m not aware of? I wonder how I can fix this.

  • I have an event in my calendar that was sent by someone who does not work for the company anymore and I am reminded 2 times a week. How can I remove it?

    I have an event in my calendar that was sent by someone that does not work for the company anymore and I am reminded 2 times a week. How do I delete it?

    Tap on the event to open the event. Click the 'Edit' button in the event bubble, then press the 'Delete Event' button at the bottom of the Edit pop-up. It's a little different for events that come through Microsoft Exchange, you tap the event to bring up bubble and click the 'Details' button, and then press 'Decline' to remove the event.

  • CALLER ID not working for International incoming calls

    Hi,
    I've a strange issue where CALLER ID not working for International incoming calls, it shows INTERNATIONAL UNKNOWN NUMBER in the phone display, but the number shows correclty in Verizon Call assistant !!!
    Any clue?

    yashshankar wrote:
    Hi
    I recently  purschased an Online number but the caller id does not work for incoming calls.How do we resolve this problem?.
    Regards
    Yash
    You didn't mention what country your Online Number is in.  Not all of Skype's Online Numbers are eligible for use as Caller ID when calling telephones or sending SMS messages.  If your number is from one of these countries (Chile, Denmark, Estonia, Hong Kong, Poland, Sweden, the UK and the US), then it can be used this way.  Otherwise, you can use a mobile number from countries other than Japan or Mexico as Caller ID with Skype, after the number goes through a verification process where Skype sends SMS messages with codes to that number.
    To get to these settings, log into your Skype account here on the Skype web site using the "Account" link at the top of this page.  You'll see a screen that would include your current Caller ID settings, and a link to change that.  If your Online Number is from one of those countries I referenced above, just select it and you're done. 
    Hope that helps!
    Patrick
    Location/Ubicacion: Arizona USA
    Time Zone/Hora Local: UTC/GMT -7
    If this message has adequately addressed your issue, please click on the “Accept as Solution” button. If you found a post useful then please "Give Kudos" at the bottom of my post, so that this information can benefit others.
    Si esto mensaje le ha ayudado, por favor haga clic en "Aceptar como solución". Si encuentra un mensaje útil, por favor "Da Kudos" al final del mensaje, por lo que esta información puede beneficiar a otros.
    I am not a Skype employee. No soy un empleado de Skype.

  • Wake on Demand: Not working for some services, others OK

    I haven't been able to figure this problem out... Wake on Demand for a previous generation Mac mini running Snow Leopard 10.6.8 works for things like a CrashPlan automated backup but does not work for things like remote SSH login or Screen Sharing. In all cases, the services are being originated on a latest generation iMac running Mac OS X Lion (10.7.2).
    While it's not an earth-shattering event to get off my backside and walk over to the Mac mini across the house to press its Shift key to waken the thing, it gets rather old to have to keep doing so, especially since CrashPlan automated backups are taking place while the Mac mini is otherwise asleep (the sleep indicator is slowly pulsing).
    I've been through the Apple tech notes regarding Wake on Demand for Snow Leopard 10.6 and have ensured that AirPort and its network are at the top-most position in their respective lists. Other than that, I'm not sure what else I can do. Wake on Network is enabled in the Snow Leopard Mac mini's network System Preferences and there doesn't seem to be any on/off option in the AirPort Extreme base station (just recently updated to 7.6 firmware).
    Any thoughts... hints... suggestions?
    One final note: this Mac mini is new as of July 2011; just days before the latest generation of Mac mini came out. It came pre-installed with Snow Leopard and, as soon as the users of this mini find software replacements for the old PPC style applicaitons they're used to using, will be upgraded to Lion. However, I feel a bit unsettled in making the move to Lion if I can't get a Snow Leopard feature to work properly. There's no telling if the Lion upgrade will actually fix this behavior or make it worse.
    Thanks in advance.

    I don't think you can wake on network with a closed lid. Try keeping the lid open and putting the machine to sleep. Does it work?

  • Image Processor not working for me. Help!

    In a nearby thread I've reached a stumbling block. Image Processor in CS4's PS is not working for me. I have a folder of psd's generated on the fly via File > Export > Data Sets as File... and now I'm trying to process those psd's to generate a JPEG of each. The only strange characteristic of the auto-generated PSD files is that there is no image preview available within the Finder. When a psd is selected the preview pane reads:
    "This layered Photoshop file was not saved with a composite image"
    I've verified in my Preferences > File Handling that image previews are always saved. (But I've been using PS for a long time and previews are always available with all my manually saved work.)
    So here's what happens when I invoke File > Scripts > Image Processor...
    In section 1 of the menu I select the source folder where the psd files reside
    In section 2, I select 'Save in same location'
    In section 3, I select 'Save as JPEG'
    In section 4, I change nothing. No special actions. Include ICC profile is checked.
    When I select run I get an error message: "Sorry, I could not process the following files:"
    And then it lists what appears to be 3 lines per psd file in the source directory:
    The path to the source dir
    The name of the source dir
    The [source_dir]/[filename.psd]
    What am I doing wrong?

    mrdior wrote:
    I have a folder of psd's generated on the fly via File > Export > Data Sets as File... and now I'm trying to process those psd's to generate a JPEG of each. The only strange characteristic of the auto-generated PSD files is that there is no image preview available within the Finder. When a psd is selected the preview pane reads:
    The part I don't understand is the "export" Part. File > Export > Data Sets as File.. on my machine is grayed out so I don't know how this feature is used. Is Export > Data Sets as File... used with CSV data sets and Photoshop variables?
    Check your Photoshop preferences and make sure you have set in the file handling tab "Maximize PSD and PSB File Compatibility:" to Always using the pull down menu. If that is not your current setting try setting that to see if the exported PSD files contain composite previews. When I use save as PSD on my system I alway see Photoshop save through up a popup window stating generating composite preview image.

  • HT5557 The ibooks dictionary works fine for my iPhone 5, but it does not work for my iPad 2. Is this fixable?

    The iBooks dictionary works fine for my iPhone 5, but it does not work for my iPad 2. Is this fixable?

    I went to the Audio store to see about getting a surround sound and the salesperson asked me why I wasn't using AirPlay, he said it was better than the Bluetooth, better quality. So I do have AirPlay on my Sony and I installed the app on my iPhone 5 but they can't find eachother.......when I try looking for my iPhone on my receiver it does not show it. The Sony display works through my TV, the set up screen is there but it says no devices found. Like I said, the Bluetooth finds the iPhone and works ok, but the AirPlay does not.....looking at the manuel it says that the AirPlay will recognize my device (iPhone 5) but it does not..........

  • Synaptics touchpad on HP Mini 110 Windows 7 32 Bit - not working for one user - working for another

    Hi,
    I recently have an issue with Synaptics touchpad on HP Mini 110 Windows 7 32 Bit - NOT working for one user - working for another.
    Windows 7 updates recently installed ???
    By checking the device properties on the user that works - "Synaptics PS/2 Port Touchpad 13/10/2011 Version 15.3.29.0"
    When the other user logs on, the touchpad works for a few seconds, then a displays a black square with a red diagonal line through it, then the touchpad won't respond. Trying to use the keypad to navigate to system diagnosics or anything to find further info is useless....

    Hey eagle_no11,
    Thank you for joining the HP Support Community!
    I will do my best in assisting to hopefully get the TouchPad to work on the second user profile.
    What I would like to start off with, is to restore the original Synaptics drivers onto the profile that is not working correctly. I have included the document Using Recovery Manager to Restore Software and Drivers (Windows 7).
    Once you have installed the original drivers, you will need to complete all updates from both HP, as well as Windows. For these updates, if you open the HP Support Assistant, and select Maintain, you should see an option for updating.
    Please let me know how these steps do work out for you.
    Have a great day!
    I worked on behalf of HP

  • Clob is not working for bulk data files in PL/SQL XML program

    Hi Odie,
    we took your help to fix the our issue before
    "https://forums.oracle.com/forums/thread.jspa?threadID=2238458&tstart=105"
    working fine for : program is working for smaller size data.
    Issue : now we have problem with the largr size data .
    getting the below error:
    Arguments
    P_dir_name='/tmp'
    P_file_name='CCBGO.COLO_CNG.RESPONSES.20120802.00054131826'
    Environment will now switch to UTF-8 code-set.
    Parts of this log file may not display correctly
    as a result. This is an expected behavior.
    XML_REPORTS_XENVIRONMENT is :
    /apps/applmgr/product/OFDEV/ofdevora/806/guicommon6/tk60/admin/Tk2Motif_UTF8.rgb
    XENVIRONMENT is set to /apps/applmgr/product/OFDEV/ofdevora/806/guicommon6/tk60/admin/Tk2Motif_UTF8.rgb
    Current NLS_LANG and NLS_NUMERIC_CHARACTERS Environment Variables are :
    American_America.UTF8
    stat_low = 8B
    stat_high = 0
    emsg:was terminated by signal 11
    Appreciated for your earlier support.
    Kindly suggest .
    Many Thanks,
    Ramesh.

    Thanks ALex,
    your are true it is concurrent program error ,
    but it is working for small amount of data and generating the output and it is not working for larger data.
    i have placed the code which i have used kindly suggest where i am going wrong.
    i am calling the .rdf through the concurrent program, i've used the below query in RDF
    select
    BATCHHEADER
    ,BATCHTRAILER
    ,RqUID
    ,Severity
    ,PmtRefId
    ,StatusDesc
    ,ErrorDesc
    ,AsOfDate
    ,AsOfTime
    ,RqUID1
    ,SPRefId
    from table(CL_CXFRFXFH_PKG.rcacknowledgments(:P_dir_name,:P_file_name));
    kindly find the below code for the package CL_CXFRFXFH_PKG.
    ==========================
    CREATE OR REPLACE package body APPS.CL_CXFRFXFH_PKG is
    function rcacknowledgments (p_directory in varchar2, p_filename in varchar2)
    return TRecordTable pipelined
    is
    nb_rec number := 1;
    tmp_xml clob;
    tmp_file clob;
    rec TRecord;
    begin
    dbms_lob.createtemporary(tmp_file, true);
    tmp_file := dbms_xslprocessor.read2clob(p_directory, p_filename);
    rec.BATCHHEADER := regexp_replace(tmp_file, '.*<BATCHHEADER>(.*)</BATCHHEADER>.*', '\1', 1, 1, 'n');
    rec.BATCHTRAILER := regexp_replace(tmp_file, '.*<BATCHTRAILER>(.*)</BATCHTRAILER>.*', '\1', 1, 1, 'n');
    loop
    tmp_xml := regexp_substr(tmp_file, '<\?xml[^?]+\?>\s*<([^>]+)>.*?</\1>', 1, nb_rec, 'n');
    exit when length(tmp_xml) = 0;
    --dbms_output.put_line(tmp_rec);
    nb_rec := nb_rec + 1;
    select RqUID, Severity, PmtRefId, StatusDesc, ErrorDesc, AsOfDate, AsOfTime, RqUID1, SPRefId
    into rec.RqUID
    , rec.Severity
    , rec.PmtRefId
    , rec.StatusDesc
    , rec.ErrorDesc
    , rec.AsOfDate
    , rec.AsOfTime
    , rec.RqUID1
    , rec.SPRefId
    from xmltable(
    '/CMA/BankSvcRq' passing xmltype(tmp_xml)
    columns RqUID varchar2(3000) path 'RqUID'
    , Severity varchar2(3000) path 'XferAddRs/Status/Severity'
    , PmtRefId varchar2(3000) path 'XferAddRs/Status/PmtRefId'
    , StatusDesc varchar2(3000) path 'XferAddRs/Status/StatusDesc'
    , ErrorDesc varchar2(3000) path 'XferAddRs/Status/ErrorDesc'
    , AsOfDate varchar2(3000) path 'XferAddRs/Status/AsOfDate'
    , AsOfTime varchar2(3000) path 'XferAddRs/Status/AsOfTime'
    , RqUID1 varchar2(3000) path 'XferAddRs/RqUID'
    , SPRefId varchar2(3000) path 'XferAddRs/SPRefId'
    pipe row ( rec );
    end loop;
    dbms_lob.freetemporary(tmp_file);
    return;
    end;
    end;
    ============================================
    Many Thanks,
    Ramesh.

Maybe you are looking for