<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Stephen Fung on Medium]]></title>
        <description><![CDATA[Stories by Stephen Fung on Medium]]></description>
        <link>https://medium.com/@stephenhlfung?source=rss-b0246597023f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*e1RmfjGBzWP4VB-1.jpeg</url>
            <title>Stories by Stephen Fung on Medium</title>
            <link>https://medium.com/@stephenhlfung?source=rss-b0246597023f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 14:11:36 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@stephenhlfung/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Populating Master-Detail Foreign Key Values]]></title>
            <link>https://medium.com/@stephenhlfung/populating-master-detail-foreign-key-values-d3dcaf88daeb?source=rss-b0246597023f------2</link>
            <guid isPermaLink="false">https://medium.com/p/d3dcaf88daeb</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[oracle]]></category>
            <category><![CDATA[oracle-apex]]></category>
            <category><![CDATA[plsql]]></category>
            <dc:creator><![CDATA[Stephen Fung]]></dc:creator>
            <pubDate>Mon, 26 Aug 2019 21:05:23 GMT</pubDate>
            <atom:updated>2019-08-26T21:05:23.195Z</atom:updated>
            <content:encoded><![CDATA[<p>In some situation, I have to retrieve the primary key of the master table and use it to INSERT a new record in the detail table. It can be done like this in PL/SQL:</p><pre>DECLARE<br>  l_order_id  NUMBER;<br>BEGIN<br>  -- Populate the master table, returning the sequence value.<br>  INSERT INTO orders (id, description)<br>  VALUES (orders_seq.NEXTVAL, &#39;Dummy order description.&#39;)<br>  RETURNING id INTO l_order_id;<br>  <br>  -- Use the returned value to populate the FK link in the detail table.<br>  INSERT INTO order_lines (id, order_id, description)<br>  VALUES (order_lines_seq.NEXTVAL, l_order_id, &#39;Dummy order line description&#39;);<br>  <br>  COMMIT;<br>END;<br>/</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d3dcaf88daeb" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>