<?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 SQL error in the database when accessing a table in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/sql-error-in-the-database-when-accessing-a-table/m-p/7804348#M1587456</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt; i'm getting error 'SQL error in the database when accessing a table' when process below sql for no's of entries&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data :qfrom type string , count type i.&lt;/P&gt;&lt;P&gt;"qfrom = 'DD01L INNER JOIN DD02L ON DD02L&lt;SUB&gt;AS4LOCAL = DD01L&lt;/SUB&gt;AS4LOCAL AND DD02L&lt;SUB&gt;AS4VERS = DD01L&lt;/SUB&gt;AS4VERS".&lt;/P&gt;&lt;P&gt;select count(*) into count from  (qfrom) .&lt;/P&gt;&lt;P&gt;  write: count.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but for other sql like below one it's working fine...&lt;/P&gt;&lt;P&gt;*qfrom = 'mara INNER JOIN mard ON mard&lt;SUB&gt;matnr = mara&lt;/SUB&gt;matnr AND mard&lt;SUB&gt;pstat = mara&lt;/SUB&gt;pstat'.&lt;/P&gt;&lt;P&gt;select count(*) into count from  (qfrom) .&lt;/P&gt;&lt;P&gt;  write: count.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Runtime Errors         DBIF_RSQL_SQL_ERROR&lt;/P&gt;&lt;P&gt;Except.                   CX_SY_OPEN_SQL_DB&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Anuj jain&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 01 Apr 2011 07:00:28 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2011-04-01T07:00:28Z</dc:date>
    <item>
      <title>SQL error in the database when accessing a table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sql-error-in-the-database-when-accessing-a-table/m-p/7804348#M1587456</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt; i'm getting error 'SQL error in the database when accessing a table' when process below sql for no's of entries&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data :qfrom type string , count type i.&lt;/P&gt;&lt;P&gt;"qfrom = 'DD01L INNER JOIN DD02L ON DD02L&lt;SUB&gt;AS4LOCAL = DD01L&lt;/SUB&gt;AS4LOCAL AND DD02L&lt;SUB&gt;AS4VERS = DD01L&lt;/SUB&gt;AS4VERS".&lt;/P&gt;&lt;P&gt;select count(*) into count from  (qfrom) .&lt;/P&gt;&lt;P&gt;  write: count.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but for other sql like below one it's working fine...&lt;/P&gt;&lt;P&gt;*qfrom = 'mara INNER JOIN mard ON mard&lt;SUB&gt;matnr = mara&lt;/SUB&gt;matnr AND mard&lt;SUB&gt;pstat = mara&lt;/SUB&gt;pstat'.&lt;/P&gt;&lt;P&gt;select count(*) into count from  (qfrom) .&lt;/P&gt;&lt;P&gt;  write: count.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Runtime Errors         DBIF_RSQL_SQL_ERROR&lt;/P&gt;&lt;P&gt;Except.                   CX_SY_OPEN_SQL_DB&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Anuj jain&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Apr 2011 07:00:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sql-error-in-the-database-when-accessing-a-table/m-p/7804348#M1587456</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-04-01T07:00:28Z</dc:date>
    </item>
    <item>
      <title>Re: SQL error in the database when accessing a table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sql-error-in-the-database-when-accessing-a-table/m-p/7804349#M1587457</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Anuj,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is because the COUNT(*) is returning a value which is longer than the INT4 data type it is expecting. If you restrict the selection by introducing a WHERE clause, then you won't get the dump:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: dyn_from    TYPE string,
      dyn_where   TYPE string,
      gx_sql_err  TYPE REF TO cx_sy_open_sql_error,
      gv_text     TYPE string.

dyn_from  = `DD01L INNER JOIN DD02L ON DD02L~AS4LOCAL = DD01L~AS4LOCAL AND DD02L~AS4VERS = DD01L~AS4VERS`.
dyn_where = `DOMNAME LIKE 'Z%'`.

TRY .

    SELECT COUNT(*) FROM (dyn_from) WHERE (dyn_where).
    WRITE: / sy-dbcnt NO-GROUPING.
  CATCH:  cx_sy_open_sql_db             INTO gx_sql_err,
          cx_sy_dynamic_osql_semantics  INTO gx_sql_err,
          cx_sy_dynamic_osql_syntax     INTO gx_sql_err.
ENDTRY.

IF gx_sql_err IS BOUND.
  gv_text = gx_sql_err-&amp;gt;get_text( ).
  WRITE: / gv_text.
ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR,&lt;/P&gt;&lt;P&gt;Suhas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Apr 2011 08:27:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sql-error-in-the-database-when-accessing-a-table/m-p/7804349#M1587457</guid>
      <dc:creator>SuhaSaha</dc:creator>
      <dc:date>2011-04-01T08:27:48Z</dc:date>
    </item>
    <item>
      <title>Re: SQL error in the database when accessing a table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sql-error-in-the-database-when-accessing-a-table/m-p/7804350#M1587458</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That's ok Suhas...but can i get this value which is more than int4 length  in any method without defined any where like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: count type string.&lt;/P&gt;&lt;P&gt;SELECT COUNT(*) into count  FROM (dyn_from) WHERE (dyn_where).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or we can not get any return value whose length is more than int4 becoz it's dependent on sy-dbcnt whose  data type is int4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards ,&lt;/P&gt;&lt;P&gt;Anuj jain&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Apr 2011 09:16:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sql-error-in-the-database-when-accessing-a-table/m-p/7804350#M1587458</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-04-01T09:16:51Z</dc:date>
    </item>
    <item>
      <title>Re: SQL error in the database when accessing a table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sql-error-in-the-database-when-accessing-a-table/m-p/7804351#M1587459</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Anuj,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A quick F1 on COUNT(*) will tell you that it expects a variable of type INT4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR,&lt;/P&gt;&lt;P&gt;Suhas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Apr 2011 09:32:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sql-error-in-the-database-when-accessing-a-table/m-p/7804351#M1587459</guid>
      <dc:creator>SuhaSaha</dc:creator>
      <dc:date>2011-04-01T09:32:39Z</dc:date>
    </item>
    <item>
      <title>Re: SQL error in the database when accessing a table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sql-error-in-the-database-when-accessing-a-table/m-p/7804352#M1587460</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can try with type DEC .&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Apr 2011 09:36:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sql-error-in-the-database-when-accessing-a-table/m-p/7804352#M1587460</guid>
      <dc:creator>Sandeep_Panghal</dc:creator>
      <dc:date>2011-04-01T09:36:37Z</dc:date>
    </item>
    <item>
      <title>Re: SQL error in the database when accessing a table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sql-error-in-the-database-when-accessing-a-table/m-p/7804353#M1587461</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks  Suhas....&lt;/P&gt;&lt;P&gt;Solved.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Apr 2011 10:06:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sql-error-in-the-database-when-accessing-a-table/m-p/7804353#M1587461</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-04-01T10:06:29Z</dc:date>
    </item>
  </channel>
</rss>

