Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8572391
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T18:59:53+00:00 2026-06-11T18:59:53+00:00

I am inserting a record within a transaction and then later I am retrieving

  • 0

I am inserting a record within a transaction and then later I am retrieving the same record via an Oracle function. The oracle function is returning no records. My DBA told me that Oracle functions do not operate inside a transaction. How do I get around this?

Example:
Begin transaction using the oracle provider

Execute some SQL:

INSERT OWNER
(FIRST_NAME, LAST_NAME)
VALUES
(‘JOHN’, ‘SMITH’)

Get the record back within the transaction from a function (71 is an example ID):
select * from table (GET_OWNER_DETAILS_FNC (71) )

Here is the Oracle Function:

CREATE OR REPLACE FUNCTION "AROH"."GET_OWNER_DETAILS_FNC" (p_owner_information_oid  in aroh_owner_information.owner_information_oid%type ) 
return OWNER_DETAILS_TABLE_TYPE_FNC

IS 
PRAGMA AUTONOMOUS_TRANSACTION; 

v_owner_details_set   OWNER_DETAILS_TABLE_TYPE_FNC := OWNER_DETAILS_TABLE_TYPE_FNC();

CURSOR c_owner_dtls IS
select oi.owner_information_oid, 
oi.first_name, 
oi.last_name, 
oi.company_name, 
oi.license_information, 
oi.company_ind, 
oi.middle_initial, 
oi.title_type_oid, 
oi.suffix, 
oi.status_type_code, 
oi.primary_phone, 
oi.secondary_phone, 
oi.secondary_phone_type_code, 
oi.primary_phone_type_code, 
oi.email_address, 
oi.comments, 
oi.primary_phone_extension, 
oi.secondary_phone_extension, 
poa.owner_address_oid as primaryaddressid, 
poa.address_type_code as primaryaddresscode, 
poa.address1 as primaryaddress1, 
poa.address2 as primaryaddress2, 
poa.city as primarycity, 
poa.state as primarystate, 
poa.postal_code as primaryzip, 
poa.current_ind as primarycurrent, 
soa.owner_address_oid as secondaryaddressid,
soa.address_type_code as secondaryaddresscode, 
soa.address1 as secondaryaddress1, 
soa.address2 as secondaryaddress2, 
soa.city as secondarycity, 
soa.state as secondarystate, 
soa.postal_code as secondaryzip, 
soa.current_ind as secondarycurrent,
(    select
      (    select oa2.owner_information_oid 
            from aroh_owner_aircraft_rlshp oa2 
            where upper(primary_owner) like '%PRIMARY%' 
                            and oa2.aircraft_oid = oa1.aircraft_oid
                            and rownum = 1) as prim_owner_oid
                from aroh_owner_aircraft_rlshp oa1
                where oa1.owner_information_oid = p_owner_information_oid
                   and rownum = 1 
) as primary_owner_oid,
(          select 
              case when (upper(primary_owner) like '%PRIMARY%')
                                                then 'Y'
                                                else 'N' end as isprimary
                from aroh_owner_aircraft_rlshp
                where owner_information_oid = p_owner_information_oid
                and rownum = 1
) as is_primary
from aroh_owner_information oi 
inner join (select * 
                  from aroh_owner_address 
                where upper(current_ind) = 'Y' 
                    and address_type_code = 'OPRIM') poa 
on oi.owner_information_oid = poa.owner_information_oid 
left outer join (select * 
                        from aroh_owner_address 
                        where upper(current_ind) = 'Y' 
                        and address_type_code = 'OSEC') soa 
on oi.owner_information_oid = soa.owner_information_oid 
where   oi.owner_information_oid = p_owner_information_oid; 

begin 

For main_row in c_owner_dtls 
loop 
  v_owner_details_set.EXTEND; 
  v_owner_details_set(v_owner_details_set.LAST) :=  OWNER_DETAILS_TYPE    (main_row.owner_information_oid  , main_row.first_name   , main_row.last_name   , main_row.company_name   
   , main_row.license_information   , main_row.company_ind   , main_row.middle_initial   , main_row.title_type_oid   , main_row.suffix    , main_row.status_type_code   , main_row.primary_phone  
   , main_row.secondary_phone   , main_row.secondary_phone_type_code   , main_row.primary_phone_type_code   , main_row.email_address   , main_row.comments   , main_row.primary_phone_extension   
   , main_row.secondary_phone_extension   , main_row.primaryaddressid   , main_row.primaryaddresscode   , main_row.primaryaddress1   , main_row.primaryaddress2   , main_row.primarycity   
   , main_row.primarystate   , main_row.primaryzip   , main_row.primarycurrent   , main_row.secondaryaddressid    , main_row.secondaryaddresscode   , main_row.secondaryaddress1   
   , main_row.secondaryaddress2   , main_row.secondarycity   , main_row.secondarystate   , main_row.secondaryzip    , main_row.secondarycurrent   , main_row.primary_owner_oid   , main_row.is_primary ); 
end loop; 

return v_owner_details_set;

EXCEPTION
When others 
then dbms_output.put_line ('Oracle error: '||SQLERRM);

end;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T18:59:54+00:00Added an answer on June 11, 2026 at 6:59 pm

    The AUTONOMOUS_TRANSACTION pragma means that the function operates in the context of a separate transaction. By default (see http://docs.oracle.com/cd/B19306_01/server.102/b14220/consist.htm#sthref1972) this uses the “read committed” isolation level, meaning that, when the transaction queries data, it sees only data that was committed before the query began. Since the data you inserted has not been committed, this means that the function can’t see it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When using NOLOGGING in Oracle, say for inserting new records. Will my database be
I'm currently inserting a record into a SQL Server Table and then selecting the
i have a procedure in which i am inserting record in employee table.nad getting
When inserting a record to a database, the server returns an 'undefined index: category',
I have done inserting a record into database but I don't know how to
I'm having great difficulty in inserting a record to my access database. I've tried
What could possibly caused a FK error? I'm inserting an 'Activity' record into a
Inserting rows one by one from a 600 record data-set is taking almost an
i am dynamically creating sql query for inserting multiple records in one hit.Suppose no
In my java web application, I am inserting some records into MySql db. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.