<?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 how to write SQL statement for EXEC with multiple select-options as condition in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-write-sql-statement-for-exec-with-multiple-select-options-as/m-p/12394210#M1995036</link>
    <description>&lt;P&gt;we have a program with three select-options S1,S2,S3. All of them are not obligatory. Now I want to connect to an oracle DB and fetch data with these select-options as condition.&lt;/P&gt;
  &lt;P&gt;The code is like:&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;EXEC SQL.
    select * into :WS from ODB 
    where o1 between s1-low and s1-high
    and o2 between s2-low and s2-high
    and o3 between s3-low and s3-high
ENDEXEC.&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;My question is if user did not input value for selection options, how to let it work? Suppose S2 is empty, I tried to assign s2-low and s2-high value of '%' but it didn't work. Thx.&lt;/P&gt;</description>
    <pubDate>Thu, 22 Apr 2021 03:48:23 GMT</pubDate>
    <dc:creator>former_member625844</dc:creator>
    <dc:date>2021-04-22T03:48:23Z</dc:date>
    <item>
      <title>how to write SQL statement for EXEC with multiple select-options as condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-write-sql-statement-for-exec-with-multiple-select-options-as/m-p/12394210#M1995036</link>
      <description>&lt;P&gt;we have a program with three select-options S1,S2,S3. All of them are not obligatory. Now I want to connect to an oracle DB and fetch data with these select-options as condition.&lt;/P&gt;
  &lt;P&gt;The code is like:&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;EXEC SQL.
    select * into :WS from ODB 
    where o1 between s1-low and s1-high
    and o2 between s2-low and s2-high
    and o3 between s3-low and s3-high
ENDEXEC.&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;My question is if user did not input value for selection options, how to let it work? Suppose S2 is empty, I tried to assign s2-low and s2-high value of '%' but it didn't work. Thx.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Apr 2021 03:48:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-write-sql-statement-for-exec-with-multiple-select-options-as/m-p/12394210#M1995036</guid>
      <dc:creator>former_member625844</dc:creator>
      <dc:date>2021-04-22T03:48:23Z</dc:date>
    </item>
    <item>
      <title>Re: how to write SQL statement for EXEC with multiple select-options as condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-write-sql-statement-for-exec-with-multiple-select-options-as/m-p/12394211#M1995037</link>
      <description>&lt;OL&gt;&lt;LI&gt;Don't use EXEC SQL. Use the CL_SQL_STATEMENT classes&lt;/LI&gt;&lt;LI&gt;There is a class method that converts select options. Read all about it here: &lt;A href="https://blogs.sap.com/2015/03/30/handling-of-select-options-parameters-within-amdp/" target="test_blank"&gt;https://blogs.sap.com/2015/03/30/handling-of-select-options-parameters-within-amdp/&lt;/A&gt; (The blog is AMDP, but it still applies).&lt;/LI&gt;&lt;/OL&gt;</description>
      <pubDate>Thu, 22 Apr 2021 07:17:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-write-sql-statement-for-exec-with-multiple-select-options-as/m-p/12394211#M1995037</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2021-04-22T07:17:21Z</dc:date>
    </item>
  </channel>
</rss>

