 




<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: How to insert data from SQL procedure</title>
	<atom:link href="http://itknowledgeexchange.techtarget.com/itanswers/how-to-insert-data-from-sql-procedure/feed/" rel="self" type="application/rss+xml" />
	<link>http://itknowledgeexchange.techtarget.com/itanswers/how-to-insert-data-from-sql-procedure/</link>
	<description></description>
	<lastBuildDate>Fri, 24 May 2013 01:03:22 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>By: 9783444184</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/how-to-insert-data-from-sql-procedure/#comment-112348</link>
		<dc:creator>9783444184</dc:creator>
		<pubDate>Wed, 17 Oct 2012 04:15:49 +0000</pubDate>
		<guid isPermaLink="false">http://itknowledgeexchange.techtarget.com/itanswers/how-to-insert-data-from-sql-procedure/#comment-112348</guid>
		<description><![CDATA[hi Tom,i have solved my problem actually when i debug my program i found in .net environment has another session so that my cursor is not open because utxie table in my library but that session not taken my library... ]]></description>
		<content:encoded><![CDATA[<p>hi Tom,i have solved my problem actually when i debug my program i found in .net environment has another session so that my cursor is not open because utxie table in my library but that session not taken my library&#8230; </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: TomLiotta</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/how-to-insert-data-from-sql-procedure/#comment-112331</link>
		<dc:creator>TomLiotta</dc:creator>
		<pubDate>Tue, 16 Oct 2012 10:08:02 +0000</pubDate>
		<guid isPermaLink="false">http://itknowledgeexchange.techtarget.com/itanswers/how-to-insert-data-from-sql-procedure/#comment-112331</guid>
		<description><![CDATA[&lt;EM&gt;when i call this proc in .net environment its not working&lt;/EM&gt;
It doesn&#039;t help to say it&#039;s &quot;not working&quot;. Why doesn&#039;t it work? What happens? Is there an error? How do you know it&#039;s &quot;not working&quot;? How do you call it? How do you know it works in STRSQL?
&#160;
I can&#039;t see how it could work. It does look like it could compile and run okay. But&#160;the way I read it, it&#160;should always produce zero rows.
&#160;

&lt;BLOCKQUOTE&gt;&lt;CODE&gt;&#160;AND &lt;STRONG&gt;A.ILINVN NOT IN&lt;/STRONG&gt; (SELECT ITXINVN FROM UTXIE C&#160;&#160;&#160;&#160; &lt;STRONG&gt;WHERE C.ITXINVN = A.ILINVN&lt;/STRONG&gt; AND C.ILORD = A.ILORD AND C.ILLINE = A.ILLINE&#160;&#160;&#160;&#160;&#160;&#160; AND C.UPDFLG =’Y&#039;) &lt;/CODE&gt;&lt;/BLOCKQUOTE&gt;

&#160;
To me, that looks like it always excludes every row. You have a sub-SELECT WHERE every row matches against A.ILINVN. But the outer condition says to only process rows from SIL A WHERE ILINVN is not in the sub-SELECT.
&#160;
Overall, it looks like the whole procedure doesn&#039;t need the RPG at all.&#160;All the procedure needs is the DELETE and an INSERT ... SELECT.
&#160;
Also, a minor change on your cursor SELECT would be to remove the ORDER BY. It doesn&#039;t seem to have any purpose.
&#160;
Tom]]></description>
		<content:encoded><![CDATA[<p><em>when i call this proc in .net environment its not working</em><br />
It doesn&#8217;t help to say it&#8217;s &#8220;not working&#8221;. Why doesn&#8217;t it work? What happens? Is there an error? How do you know it&#8217;s &#8220;not working&#8221;? How do you call it? How do you know it works in STRSQL?<br />
&nbsp;<br />
I can&#8217;t see how it could work. It does look like it could compile and run okay. But&nbsp;the way I read it, it&nbsp;should always produce zero rows.<br />
&nbsp;</p>
<blockquote><p><code>&nbsp;AND <strong>A.ILINVN NOT IN</strong> (SELECT ITXINVN FROM UTXIE C&nbsp;&nbsp;&nbsp;&nbsp; <strong>WHERE C.ITXINVN = A.ILINVN</strong> AND C.ILORD = A.ILORD AND C.ILLINE = A.ILLINE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AND C.UPDFLG =’Y&#8217;) </code></p></blockquote>
<p>&nbsp;<br />
To me, that looks like it always excludes every row. You have a sub-SELECT WHERE every row matches against A.ILINVN. But the outer condition says to only process rows from SIL A WHERE ILINVN is not in the sub-SELECT.<br />
&nbsp;<br />
Overall, it looks like the whole procedure doesn&#8217;t need the RPG at all.&nbsp;All the procedure needs is the DELETE and an INSERT &#8230; SELECT.<br />
&nbsp;<br />
Also, a minor change on your cursor SELECT would be to remove the ORDER BY. It doesn&#8217;t seem to have any purpose.<br />
&nbsp;<br />
Tom</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: 9783444184</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/how-to-insert-data-from-sql-procedure/#comment-112329</link>
		<dc:creator>9783444184</dc:creator>
		<pubDate>Tue, 16 Oct 2012 08:58:49 +0000</pubDate>
		<guid isPermaLink="false">http://itknowledgeexchange.techtarget.com/itanswers/how-to-insert-data-from-sql-procedure/#comment-112329</guid>
		<description><![CDATA[okwhen i run this proc in strsql it wring fine but when i call this proc in .net environment its not working]]></description>
		<content:encoded><![CDATA[<p>okwhen i run this proc in strsql it wring fine but when i call this proc in .net environment its not working</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: TomLiotta</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/how-to-insert-data-from-sql-procedure/#comment-112328</link>
		<dc:creator>TomLiotta</dc:creator>
		<pubDate>Tue, 16 Oct 2012 08:57:53 +0000</pubDate>
		<guid isPermaLink="false">http://itknowledgeexchange.techtarget.com/itanswers/how-to-insert-data-from-sql-procedure/#comment-112328</guid>
		<description><![CDATA[&lt;EM&gt;how can i insert data from sql procedure in proceduer&lt;/EM&gt;
&#160;
You insert rows with an INSERT statement.
&#160;
&lt;EM&gt;i am using cursor.&lt;/EM&gt;
&#160;
So? What does a cursor have to do with an INSERT?
&#160;
A common rule of thumb is &quot;If you&#039;re using a cursor, you&#039;re probably doing it wrong.&quot; The meaning is that most cursors (by users who have trouble) are unnecessary. SQL usually provides set operations that can replace unneeded cursors. It&#039;s nice to know that you&#039;re using a cursor, but it doesn&#039;t help at all without knowing why it&#039;s needed and how it&#039;s used.
&#160;
Tom]]></description>
		<content:encoded><![CDATA[<p><em>how can i insert data from sql procedure in proceduer</em><br />
&nbsp;<br />
You insert rows with an INSERT statement.<br />
&nbsp;<br />
<em>i am using cursor.</em><br />
&nbsp;<br />
So? What does a cursor have to do with an INSERT?<br />
&nbsp;<br />
A common rule of thumb is &#8220;If you&#8217;re using a cursor, you&#8217;re probably doing it wrong.&#8221; The meaning is that most cursors (by users who have trouble) are unnecessary. SQL usually provides set operations that can replace unneeded cursors. It&#8217;s nice to know that you&#8217;re using a cursor, but it doesn&#8217;t help at all without knowing why it&#8217;s needed and how it&#8217;s used.<br />
&nbsp;<br />
Tom</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: 9783444184</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/how-to-insert-data-from-sql-procedure/#comment-112327</link>
		<dc:creator>9783444184</dc:creator>
		<pubDate>Tue, 16 Oct 2012 08:54:48 +0000</pubDate>
		<guid isPermaLink="false">http://itknowledgeexchange.techtarget.com/itanswers/how-to-insert-data-from-sql-procedure/#comment-112327</guid>
		<description><![CDATA[     d@LWCUS           s              6  0
     d@UPCUS           s              6  0
     d@LINVN           s              8  0
     d@UINVN           s              8  0
     d@LWORD           s              8  0
     d@UPORD           s              8  0
     DW8ORD            S              8S 0 INZ(0)
     DW8ORD1           S              8  0 INZ(0)
     DW8INV            S              8S 0 INZ(0)
     DW8INV1           S              8  0 INZ(0)
     DW8INVOLD         S              8S 0 INZ(0)
     DW8CUST           S              6S 0 INZ(0)
     DW8CUST1          S              6  0 INZ(0)
     DW8OTYP           S              1    INZ(*BLANKS)
     DW2ROW            S              2P 0 INZ(09)
     DW2COL            S              2P 0 INZ(30)
     DW2CALL           S              1A   INZ(&#039;1&#039;)
     D*W2CUSTF          S                   LIKE(XLWCUS)
     DT1RTPM           S              1A   INZ(*BLANKS)
     DT1DTFM           S              1  0 INZ(*BLANKS)
     DT1DTE6           S              6  0 INZ(*BLANKS)
     DT1DTE8           S              8  0 INZ(*BLANKS)
     DT8PROG           S             10A   INZ(*BLANKS)
     DT8PNL            S              3A   INZ(*BLANKS)
     DW0OFF            S              1A   INZ(*BLANKS)
     DW0ON             S              1A   INZ(*BLANKS)
     DW8ERR            S              1A   INZ(*BLANKS)
     DW8ERRF           S              1A   INZ(*BLANKS)
     DXSPDTE           S              6S 0 INZ(*ZEROS)
     DMSGFLG           S              1A   INZ(&#039;N&#039;)
     DTOP              S              1    INZ(*BLANKS)
     DCOUNT1           S              1S 0 INZ(*ZEROS)
     DBOTTOM           S              1    INZ(*BLANKS)
     DEND              S              1    INZ(*BLANKS)
     DW8ORDUP          S              8  0
     DW8ORDDW          S              8  0
     DW8INVUP          S              8  0
     DW8INVDW          S              8  0
     DW8CUSUP          S              6  0
     DW8CUSDW          S              6  0

     c*    *entry        plist
     c*                  parm                    XLWCUS            6
     c*                  parm                    XUPCUS            6
     c*                  parm                    XLINVN            8
     c*                  parm                    XUINVN            8
     c*                  parm                    XLWORD            8
     c*                  parm                    XUPORD            8
     c*                  parm                    W8CUST            6
     c*                  parm                    W8INV             8
     c*                  parm                    W8ORD             8
     c*                  eval      XLWCUS=%trimr(XLWCUS)
     c*                  eval      XUPCUS=%trimr(XUPCUS)
     c*                  eval      XLINVN=%trimr(XLINVN)
     c*                  eval      XUINVN=%trimr(XUINVN)
     c*                  eval      XLWORD=%trimr(XLWORD)
     c*                  eval      XUPORD=%trimr(XUPORD)
     c*                  move      XLWCUS        @LWCUS
     c*                  move      XUPCUS        @UPCUS
     c*                  move      XLINVN        @LINVN
     c*                  move      XUINVN        @UINVN
     c*                  move      XLWORD        @LWORD
     c*                  move      XUPORD        @UPORD
     c                   eval      @LWCUS=35001
     c                   eval      @UPCUS=35015
     c                   eval      @LINVN=00000000
     c                   eval      @UINVN=99999999
     c                   eval      @LWORD=00000000
     c                   eval      @UPORD=99999999
     c
     C/EXEC SQL
     C+ Set Option Commit=*none
     C/END-EXEC

     C/EXEC SQL
     C+ DELETE FROM amits/TESTPUTX
     C/END-EXEC
     c

     C/EXEC SQL
     C+ DECLARE S1 CURSOR FOR SELECT ILCUST, ILINVN, ILORD FROM SIL A,SIH B
     C+ WHERE A.ILCUST BETWEEN :@LWCUS AND :@UPCUS AND B.SICUST = A.ILCUST
     C+ AND A.ILINVN BETWEEN :@LINVN AND :@UINVN AND B.SIINVN = A.ILINVN
     C+ AND A.ILORD BETWEEN :@LWORD AND :@UPORD AND B.SIORD = A.ILORD AND
     C+ IHUTYP &lt;&gt; &#039;9&#039; AND A.ILINVN NOT IN (SELECT ITXINVN FROM UTXIE C WHERE
     C+ C.ITXINVN = A.ILINVN AND C.ILORD = A.ILORD AND C.ILLINE = A.ILLINE
     C+ AND C.UPDFLG =&#039;Y&#039;) AND (A.ILWHS IN
     C+  (SELECT LWHS FROM IWM C ,ZCC D WHERE C.LWHS = A.ILWHS AND D.CCID = &#039;CC&#039;
     C+   AND D.CCTABL = &#039;ITXFAC&#039; AND D.CCCODE = C.WMFAC))
     C+ ORDER BY A.ILINVN
     C/END-EXEC
     C*
     C/EXEC SQL
     C+ OPEN S1
     C/END-EXEC
     C*
     C/EXEC SQL
     C+ FETCH S1 INTO :W8CUST, :W8INV, :W8ORD
     C/END-EXEC

     C                   dow       SQLCOD = 0
     C/EXEC SQL
     C+ insert INTO amits/TESTPUTX (Y8CUST,Y8INV,Y8ORD)
     c+ values(:W8CUST,:W8INV,:W8ORD)
     C/END-EXEC

     C/EXEC SQL
     C+ FETCH S1 INTO :W8CUST, :W8INV, :W8ORD
     C/END-EXEC

     C                   ENDDO
     C/EXEC SQL
     C+ CLOSE S1
     C/END-EXEC

     c                   eval      *inlr=*on
]]></description>
		<content:encoded><![CDATA[<p>     d@LWCUS           s              6  0<br />
     d@UPCUS           s              6  0<br />
     d@LINVN           s              8  0<br />
     d@UINVN           s              8  0<br />
     d@LWORD           s              8  0<br />
     d@UPORD           s              8  0<br />
     DW8ORD            S              8S 0 INZ(0)<br />
     DW8ORD1           S              8  0 INZ(0)<br />
     DW8INV            S              8S 0 INZ(0)<br />
     DW8INV1           S              8  0 INZ(0)<br />
     DW8INVOLD         S              8S 0 INZ(0)<br />
     DW8CUST           S              6S 0 INZ(0)<br />
     DW8CUST1          S              6  0 INZ(0)<br />
     DW8OTYP           S              1    INZ(*BLANKS)<br />
     DW2ROW            S              2P 0 INZ(09)<br />
     DW2COL            S              2P 0 INZ(30)<br />
     DW2CALL           S              1A   INZ(&#8217;1&#8242;)<br />
     D*W2CUSTF          S                   LIKE(XLWCUS)<br />
     DT1RTPM           S              1A   INZ(*BLANKS)<br />
     DT1DTFM           S              1  0 INZ(*BLANKS)<br />
     DT1DTE6           S              6  0 INZ(*BLANKS)<br />
     DT1DTE8           S              8  0 INZ(*BLANKS)<br />
     DT8PROG           S             10A   INZ(*BLANKS)<br />
     DT8PNL            S              3A   INZ(*BLANKS)<br />
     DW0OFF            S              1A   INZ(*BLANKS)<br />
     DW0ON             S              1A   INZ(*BLANKS)<br />
     DW8ERR            S              1A   INZ(*BLANKS)<br />
     DW8ERRF           S              1A   INZ(*BLANKS)<br />
     DXSPDTE           S              6S 0 INZ(*ZEROS)<br />
     DMSGFLG           S              1A   INZ(&#8216;N&#8217;)<br />
     DTOP              S              1    INZ(*BLANKS)<br />
     DCOUNT1           S              1S 0 INZ(*ZEROS)<br />
     DBOTTOM           S              1    INZ(*BLANKS)<br />
     DEND              S              1    INZ(*BLANKS)<br />
     DW8ORDUP          S              8  0<br />
     DW8ORDDW          S              8  0<br />
     DW8INVUP          S              8  0<br />
     DW8INVDW          S              8  0<br />
     DW8CUSUP          S              6  0<br />
     DW8CUSDW          S              6  0</p>
<p>     c*    *entry        plist<br />
     c*                  parm                    XLWCUS            6<br />
     c*                  parm                    XUPCUS            6<br />
     c*                  parm                    XLINVN            8<br />
     c*                  parm                    XUINVN            8<br />
     c*                  parm                    XLWORD            8<br />
     c*                  parm                    XUPORD            8<br />
     c*                  parm                    W8CUST            6<br />
     c*                  parm                    W8INV             8<br />
     c*                  parm                    W8ORD             8<br />
     c*                  eval      XLWCUS=%trimr(XLWCUS)<br />
     c*                  eval      XUPCUS=%trimr(XUPCUS)<br />
     c*                  eval      XLINVN=%trimr(XLINVN)<br />
     c*                  eval      XUINVN=%trimr(XUINVN)<br />
     c*                  eval      XLWORD=%trimr(XLWORD)<br />
     c*                  eval      XUPORD=%trimr(XUPORD)<br />
     c*                  move      XLWCUS        @LWCUS<br />
     c*                  move      XUPCUS        @UPCUS<br />
     c*                  move      XLINVN        @LINVN<br />
     c*                  move      XUINVN        @UINVN<br />
     c*                  move      XLWORD        @LWORD<br />
     c*                  move      XUPORD        @UPORD<br />
     c                   eval      @LWCUS=35001<br />
     c                   eval      @UPCUS=35015<br />
     c                   eval      @LINVN=00000000<br />
     c                   eval      @UINVN=99999999<br />
     c                   eval      @LWORD=00000000<br />
     c                   eval      @UPORD=99999999<br />
     c<br />
     C/EXEC SQL<br />
     C+ Set Option Commit=*none<br />
     C/END-EXEC</p>
<p>     C/EXEC SQL<br />
     C+ DELETE FROM amits/TESTPUTX<br />
     C/END-EXEC<br />
     c</p>
<p>     C/EXEC SQL<br />
     C+ DECLARE S1 CURSOR FOR SELECT ILCUST, ILINVN, ILORD FROM SIL A,SIH B<br />
     C+ WHERE A.ILCUST BETWEEN :@LWCUS AND :@UPCUS AND B.SICUST = A.ILCUST<br />
     C+ AND A.ILINVN BETWEEN :@LINVN AND :@UINVN AND B.SIINVN = A.ILINVN<br />
     C+ AND A.ILORD BETWEEN :@LWORD AND :@UPORD AND B.SIORD = A.ILORD AND<br />
     C+ IHUTYP &lt;&gt; &#8217;9&#8242; AND A.ILINVN NOT IN (SELECT ITXINVN FROM UTXIE C WHERE<br />
     C+ C.ITXINVN = A.ILINVN AND C.ILORD = A.ILORD AND C.ILLINE = A.ILLINE<br />
     C+ AND C.UPDFLG =&#8217;Y') AND (A.ILWHS IN<br />
     C+  (SELECT LWHS FROM IWM C ,ZCC D WHERE C.LWHS = A.ILWHS AND D.CCID = &#8216;CC&#8217;<br />
     C+   AND D.CCTABL = &#8216;ITXFAC&#8217; AND D.CCCODE = C.WMFAC))<br />
     C+ ORDER BY A.ILINVN<br />
     C/END-EXEC<br />
     C*<br />
     C/EXEC SQL<br />
     C+ OPEN S1<br />
     C/END-EXEC<br />
     C*<br />
     C/EXEC SQL<br />
     C+ FETCH S1 INTO :W8CUST, :W8INV, :W8ORD<br />
     C/END-EXEC</p>
<p>     C                   dow       SQLCOD = 0<br />
     C/EXEC SQL<br />
     C+ insert INTO amits/TESTPUTX (Y8CUST,Y8INV,Y8ORD)<br />
     c+ values(:W8CUST,:W8INV,:W8ORD)<br />
     C/END-EXEC</p>
<p>     C/EXEC SQL<br />
     C+ FETCH S1 INTO :W8CUST, :W8INV, :W8ORD<br />
     C/END-EXEC</p>
<p>     C                   ENDDO<br />
     C/EXEC SQL<br />
     C+ CLOSE S1<br />
     C/END-EXEC</p>
<p>     c                   eval      *inlr=*on</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: 9783444184</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/how-to-insert-data-from-sql-procedure/#comment-112326</link>
		<dc:creator>9783444184</dc:creator>
		<pubDate>Tue, 16 Oct 2012 08:44:52 +0000</pubDate>
		<guid isPermaLink="false">http://itknowledgeexchange.techtarget.com/itanswers/how-to-insert-data-from-sql-procedure/#comment-112326</guid>
		<description><![CDATA[CREATE PROCEDURE AMITS.UTXPROC ( ) 
	LANGUAGE RPGLE 
	SPECIFIC AMITS.UTXPROC 
	NOT DETERMINISTIC 
	MODIFIES SQL DATA 
	CALLED ON NULL INPUT 
	EXTERNAL NAME &#039;AMITS/TESTUTX&#039; 
	PARAMETER STYLE GENERAL ;]]></description>
		<content:encoded><![CDATA[<p>CREATE PROCEDURE AMITS.UTXPROC ( )<br />
	LANGUAGE RPGLE<br />
	SPECIFIC AMITS.UTXPROC<br />
	NOT DETERMINISTIC<br />
	MODIFIES SQL DATA<br />
	CALLED ON NULL INPUT<br />
	EXTERNAL NAME &#8216;AMITS/TESTUTX&#8217;<br />
	PARAMETER STYLE GENERAL ;</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using memcached
Database Caching 6/9 queries in 0.012 seconds using memcached
Object Caching 338/341 objects using memcached

Served from: itknowledgeexchange.techtarget.com @ 2013-05-24 01:51:28 -->