<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: shrileela</title>
    <description>The latest articles on DEV Community by shrileela (@shrileela_608ebbf730fcdf4).</description>
    <link>https://dev.to/shrileela_608ebbf730fcdf4</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2846941%2Fa39da7a1-7ddc-467e-a043-4ccf487cd05e.png</url>
      <title>DEV Community: shrileela</title>
      <link>https://dev.to/shrileela_608ebbf730fcdf4</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/shrileela_608ebbf730fcdf4"/>
    <language>en</language>
    <item>
      <title>Unable to Return Multiple Rows from a MySQL Function</title>
      <dc:creator>shrileela</dc:creator>
      <pubDate>Tue, 11 Feb 2025 10:31:30 +0000</pubDate>
      <link>https://dev.to/shrileela_608ebbf730fcdf4/unable-to-return-multiple-rows-from-a-mysql-function-3fj</link>
      <guid>https://dev.to/shrileela_608ebbf730fcdf4/unable-to-return-multiple-rows-from-a-mysql-function-3fj</guid>
      <description>&lt;p&gt;I am trying to create a MySQL function that returns multiple rows, but I am unable to achieve the expected result. Here’s what I attempted:&lt;/p&gt;

&lt;p&gt;DELIMITER $$&lt;/p&gt;

&lt;p&gt;CREATE FUNCTION FUN_GET_ORDERS_BY_CUSTOMER(p_customer_id INT) &lt;br&gt;
RETURNS TABLE &lt;br&gt;
AS&lt;br&gt;&lt;br&gt;
RETURN &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT 
order_id, 
order_date, 
total_amount 
FROM 
orders 
WHERE customer_id = p_customer_id; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;$$&lt;/p&gt;

&lt;p&gt;DELIMITER ;&lt;/p&gt;

&lt;p&gt;But this gives me a syntax error because MySQL functions don’t support returning tables directly like in some other databases.&lt;/p&gt;

&lt;p&gt;What would be the best way to rewrite this function to return multiple rows?&lt;/p&gt;

&lt;p&gt;Any guidance or best practices would be appreciated!&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
