<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Return value from Oracle function in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/return-value-from-oracle-function/m-p/5162869#M664579</link>
    <description>Hi&lt;BR /&gt;&lt;BR /&gt;Your problem comes from not enabling the output from sqlplus. The following script will do what you want and enables and disables all the bits you should do by default&lt;BR /&gt;&lt;BR /&gt;retval=`echo "set serveroutput on&lt;BR /&gt;set echo off verify off pages 0 feedback off heading off&lt;BR /&gt;execute dbms_output.put_line(f_number());&lt;BR /&gt;exit;" |sqlplus -s &lt;CONNECT&gt;`&lt;BR /&gt;echo $retval&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;The various SET options are documented in the Oracle SQL*Plus manual  &lt;A href="http://download-west.oracle.com/docs/cd/B10501_01/server.920/a90842/ch13.htm#1011230" target="_blank"&gt;http://download-west.oracle.com/docs/cd/B10501_01/server.920/a90842/ch13.htm#1011230&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Malcolm&lt;BR /&gt;&lt;/CONNECT&gt;</description>
    <pubDate>Fri, 13 Mar 2009 10:06:25 GMT</pubDate>
    <dc:creator>Malcolm Leckie</dc:creator>
    <dc:date>2009-03-13T10:06:25Z</dc:date>
    <item>
      <title>Return value from Oracle function</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/return-value-from-oracle-function/m-p/5162868#M664578</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I am calling a oracle function in unix. I have tried like &lt;BR /&gt;&lt;BR /&gt;retval=`echo "declare var number &lt;BR /&gt;begin var:=function(); &lt;BR /&gt;dbms_output.put_line(var);&lt;BR /&gt;end;" |sqlplus -s &lt;CONNECT&gt;`&lt;BR /&gt;&lt;BR /&gt;I have dbms out inside the function also. the retval has all the outputs in it. Is there any other way to capture the return value alone. select function() from dual; is not working since function is doing DML operation.&lt;/CONNECT&gt;</description>
      <pubDate>Thu, 12 Mar 2009 07:33:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/return-value-from-oracle-function/m-p/5162868#M664578</guid>
      <dc:creator>MAYIANAN</dc:creator>
      <dc:date>2009-03-12T07:33:46Z</dc:date>
    </item>
    <item>
      <title>Re: Return value from Oracle function</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/return-value-from-oracle-function/m-p/5162869#M664579</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;Your problem comes from not enabling the output from sqlplus. The following script will do what you want and enables and disables all the bits you should do by default&lt;BR /&gt;&lt;BR /&gt;retval=`echo "set serveroutput on&lt;BR /&gt;set echo off verify off pages 0 feedback off heading off&lt;BR /&gt;execute dbms_output.put_line(f_number());&lt;BR /&gt;exit;" |sqlplus -s &lt;CONNECT&gt;`&lt;BR /&gt;echo $retval&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;The various SET options are documented in the Oracle SQL*Plus manual  &lt;A href="http://download-west.oracle.com/docs/cd/B10501_01/server.920/a90842/ch13.htm#1011230" target="_blank"&gt;http://download-west.oracle.com/docs/cd/B10501_01/server.920/a90842/ch13.htm#1011230&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Malcolm&lt;BR /&gt;&lt;/CONNECT&gt;</description>
      <pubDate>Fri, 13 Mar 2009 10:06:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/return-value-from-oracle-function/m-p/5162869#M664579</guid>
      <dc:creator>Malcolm Leckie</dc:creator>
      <dc:date>2009-03-13T10:06:25Z</dc:date>
    </item>
    <item>
      <title>Re: Return value from Oracle function</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/return-value-from-oracle-function/m-p/5162870#M664580</link>
      <description>Do I understand you correctly that you the output from is indeed happening and captured in 'retval' as a piece of string.&lt;BR /&gt;&lt;BR /&gt;Now you want a second, seperated value returned. Right? Well, for a limited range of values you can use the 'exit xxx' in sqlplus and pick that up in the shell in '$?'&lt;BR /&gt;&lt;BR /&gt;You may want to combine that with "whenever sqlerror exit xxx"&lt;BR /&gt;&lt;BR /&gt;Google for "sqlplus exit status" surely will render useful hints !? Had you not tried that first? &lt;BR /&gt;&lt;BR /&gt;hth,&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 13 Mar 2009 10:36:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/return-value-from-oracle-function/m-p/5162870#M664580</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2009-03-13T10:36:04Z</dc:date>
    </item>
    <item>
      <title>Re: Return value from Oracle function</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/return-value-from-oracle-function/m-p/5162871#M664581</link>
      <description>Thanks guyz for your reply.&lt;BR /&gt;&lt;BR /&gt;Malcolm Leckie, I have enabled the ouput from sqlplus. But not written in my sample code. I am having many dbms_out from the function and i am getting all the ouputs along with return code in this retval&lt;BR /&gt;&lt;BR /&gt;Hein van den Heuvel, I could not able to use whenever sqlerror. Since i need to capture the value that the function returns. $? just says the status of previous statement execution right and it will not return the value that oracle function returns.&lt;BR /&gt;&lt;BR /&gt;I have handled the situation like redirecting all the output from function along with return code like dbms_output_put_line('RETCODE'||retval) and from shellscript i grep for RETCODE and used the retval.</description>
      <pubDate>Fri, 13 Mar 2009 15:10:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/return-value-from-oracle-function/m-p/5162871#M664581</guid>
      <dc:creator>MAYIANAN</dc:creator>
      <dc:date>2009-03-13T15:10:19Z</dc:date>
    </item>
    <item>
      <title>Re: Return value from Oracle function</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/return-value-from-oracle-function/m-p/5162872#M664582</link>
      <description>Already replied</description>
      <pubDate>Fri, 13 Mar 2009 15:23:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/return-value-from-oracle-function/m-p/5162872#M664582</guid>
      <dc:creator>MAYIANAN</dc:creator>
      <dc:date>2009-03-13T15:23:31Z</dc:date>
    </item>
  </channel>
</rss>

