<?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>Question Re: Executing SQL queries in SAP-GUI e.g. select * from but000 in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/executing-sql-queries-in-sap-gui-e-g-select-from-but000/qaa-p/8314197#M2958756</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Volker,&lt;/P&gt;&lt;P&gt;thanks for that real life example. Until now i have never seen such a behavior on (our) SAP systems, but as this a wanted behavior by SAP for prior 11g R2 database releases (regarding sapnote #1387135) it could be titled as "works-as-designed".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is even worse if you as a customer add some Z columns and want to index them in an OLTP environment (B*Tree indexes). It is some kind of blind flight, because of SAP is not continuous in this case. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am pretty sure that the ABAP developers are not aware of that database internals (B*Tree indexes contain no NULL values, if NULLABLE columns are indexed only).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again for pointing out this case - pretty awesome that we can learn new stuff from each other here every day &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Stefan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 26 Nov 2011 22:08:05 GMT</pubDate>
    <dc:creator>stefan_koehler</dc:creator>
    <dc:date>2011-11-26T22:08:05Z</dc:date>
    <item>
      <title>Executing SQL queries in SAP-GUI e.g. select * from but000</title>
      <link>https://community.sap.com/t5/technology-q-a/executing-sql-queries-in-sap-gui-e-g-select-from-but000/qaq-p/8314189</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hallo,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am newbie in the SAP world. Is there a way to run select statements from SAP GUI? e.g. I want to know how many rows are returning from a join xyz.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;select count(&lt;/STRONG&gt;) from tabA and tabB where tabA.id = tabB.id and tabA.Name is not null.*&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is it possible with SQVI (SQ01)?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Nov 2011 12:54:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/executing-sql-queries-in-sap-gui-e-g-select-from-but000/qaq-p/8314189</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-11-25T12:54:17Z</dc:date>
    </item>
    <item>
      <title>Re: Executing SQL queries in SAP-GUI e.g. select * from but000</title>
      <link>https://community.sap.com/t5/technology-q-a/executing-sql-queries-in-sap-gui-e-g-select-from-but000/qaa-p/8314190#M2958749</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm not using 4.7E, but I thinkl it could be in transaction ST04N --&amp;gt; Oracle Database Administration --&amp;gt; Additional Functions --&amp;gt; SQL Command Editor.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Nere&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Nov 2011 13:13:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/executing-sql-queries-in-sap-gui-e-g-select-from-but000/qaa-p/8314190#M2958749</guid>
      <dc:creator>aena_dtiddsap</dc:creator>
      <dc:date>2011-11-25T13:13:12Z</dc:date>
    </item>
    <item>
      <title>Re: Executing SQL queries in SAP-GUI e.g. select * from but000</title>
      <link>https://community.sap.com/t5/technology-q-a/executing-sql-queries-in-sap-gui-e-g-select-from-but000/qaa-p/8314191#M2958750</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello thewesen,&lt;/P&gt;&lt;P&gt;yes you can execute queries with the SQL command editor like mentioned by Nere before. The full navigation path is "Transaction DBACOCKPIT -- Performance -- Additional Functions -- SQL Command Editor".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;By the way you don't need to specify any "IS NOT NULL" condition in your queries, because of in a SAP environment every column is defined with a NOT NULL constraint. The optimizer is aware of this, but to simplify your queries you can remove this stuff &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Stefan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Nov 2011 14:18:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/executing-sql-queries-in-sap-gui-e-g-select-from-but000/qaa-p/8314191#M2958750</guid>
      <dc:creator>stefan_koehler</dc:creator>
      <dc:date>2011-11-25T14:18:59Z</dc:date>
    </item>
    <item>
      <title>Re: Executing SQL queries in SAP-GUI e.g. select * from but000</title>
      <link>https://community.sap.com/t5/technology-q-a/executing-sql-queries-in-sap-gui-e-g-select-from-but000/qaa-p/8314192#M2958751</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select count(&lt;STRONG&gt;) from tabA and tabB where tabA.id = tabB.id and tabA.Name is not null.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can either user Abap query (SQ01) or ABAP editor (SE38) to write respective piece of code and execute the same.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Deepak Kori&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Nov 2011 14:43:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/executing-sql-queries-in-sap-gui-e-g-select-from-but000/qaa-p/8314192#M2958751</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-11-25T14:43:07Z</dc:date>
    </item>
    <item>
      <title>Re: Executing SQL queries in SAP-GUI e.g. select * from but000</title>
      <link>https://community.sap.com/t5/technology-q-a/executing-sql-queries-in-sap-gui-e-g-select-from-but000/qaa-p/8314193#M2958752</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; By the way you don't need to specify any "IS NOT NULL" condition in your queries, because of in a SAP environment every column is defined with a NOT NULL constraint. The optimizer is aware of this, but to simplify your queries you can remove this stuff &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; Regards&lt;/P&gt;&lt;P&gt;&amp;gt; Stefan&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry to correct you Stefan, &lt;/P&gt;&lt;P&gt;when you add a Column to an existing table, the DB conversion will execute&lt;/P&gt;&lt;P&gt;an "alter table add column" and the added column will not have a null constrataint.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The SAP Kernel is (sometimes ?) aware of this, so it (eventually ?) transforms querys in a way like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
select field1, nvl(field2, ' ' ) as field2, ...
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;... so the query will in fact not return NULL to SAP, but the table may contain NULL.&lt;/P&gt;&lt;P&gt;I have seen such conversions in SQL-Traces and I have been wondering where this comes from.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So if you execute native queries, you might need to take NULL Colums into account.&lt;/P&gt;&lt;P&gt;And even more: You need to be extremely carefull, if you intend to use an "add column" field &lt;/P&gt;&lt;P&gt;in an index, because NULL Values will not be indexed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And since version 11 it is again different, because now you can add a column with a not null constraint, &lt;/P&gt;&lt;P&gt;provided the fact that you define a DEFAULT value in addition. But there are gotchas as well:&lt;/P&gt;&lt;P&gt;The NULL VALUES are not updated with real data (otherwise the ADD COLUMN would take too long),&lt;/P&gt;&lt;P&gt;so changing the default value will have the same effect as updating all records that have NULL values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have not fully tested the stuff around this (I have this scheduled for the week between chrismas and new year &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt; )&lt;/P&gt;&lt;P&gt;but I'll come back with results on that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Volker&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Nov 2011 15:53:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/executing-sql-queries-in-sap-gui-e-g-select-from-but000/qaa-p/8314193#M2958752</guid>
      <dc:creator>volker_borowski2</dc:creator>
      <dc:date>2011-11-25T15:53:42Z</dc:date>
    </item>
    <item>
      <title>Re: Executing SQL queries in SAP-GUI e.g. select * from but000</title>
      <link>https://community.sap.com/t5/technology-q-a/executing-sql-queries-in-sap-gui-e-g-select-from-but000/qaa-p/8314194#M2958753</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Volker,&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;Sorry to correct you Stefan,&lt;/P&gt;&lt;P&gt;when you add a Column to an existing table, the DB conversion will execute&lt;/P&gt;&lt;P&gt;an "alter table add column" and the added column will not have a null constrataint.&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;No problem at all &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt; ... but i was confused about your counterstatement, so i just created a table (with CHAR fields) and added a "non key" column (CHAR) without an initial value afterwards.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
** BEFORE
SYS@&amp;lt;SID&amp;gt;:229&amp;gt; desc SAPSR3.ZZMYTEST;
 Name					   Null?    Type
 ----------------------------------------- -------- ----------------------------
 TEST					   NOT NULL VARCHAR2(9)
 TEST2					   NOT NULL VARCHAR2(117)

--- Now i added a new column called NEWCOL to the ABAP DDIC and activated the table.
--- The column NEWCOL was not a key column and the checkbox for an 
--- initial value was *NOT* checked

** AFTERWARDS
SYS@&amp;lt;SID&amp;gt;:229&amp;gt; desc SAPSR3.ZZMYTEST;
 Name					   Null?    Type
 ----------------------------------------- -------- ----------------------------
 TEST					   NOT NULL VARCHAR2(9)
 TEST2					   NOT NULL VARCHAR2(117)
 NEWCOL 				   NOT NULL VARCHAR2(117)
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;As you can see you always have a NOT NULL constraint on it - even for new added columns. My SAP system was an ECC 7.01 with 7.01 Kernel. I also have never seen the SAP kernel using the NVL() function - but that does not mean that the kernel doesn't do that of course &lt;SPAN __jive_emoticon_name="wink"&gt;&lt;/SPAN&gt;)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Update&lt;/STRONG&gt;: Now i see what you mean - i checked sapnote #1387135 ... so you are right too .. thanks for the correction &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Stefan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Nov 2011 16:10:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/executing-sql-queries-in-sap-gui-e-g-select-from-but000/qaa-p/8314194#M2958753</guid>
      <dc:creator>stefan_koehler</dc:creator>
      <dc:date>2011-11-25T16:10:12Z</dc:date>
    </item>
    <item>
      <title>Re: Executing SQL queries in SAP-GUI e.g. select * from but000</title>
      <link>https://community.sap.com/t5/technology-q-a/executing-sql-queries-in-sap-gui-e-g-select-from-but000/qaa-p/8314195#M2958754</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; &lt;STRONG&gt;Update&lt;/STRONG&gt;: Now i see what you mean - i checked sapnote #1387135 ... so you are right too .. thanks for the correction &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;) &lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;yes, exactly this is the new feature.&lt;/P&gt;&lt;P&gt;Very valuable for big bw tables which you migh otherwise no be able to tackle at all.&lt;/P&gt;&lt;P&gt;But also very dangerous if you are not aware if this is in place.&lt;/P&gt;&lt;P&gt;The values on the DB will be still NULL Values and only a query will deliver data.&lt;/P&gt;&lt;P&gt;What happens if such a column is indexed ???&lt;/P&gt;&lt;P&gt;What happens if you change the default value ???&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And what happens to old stuff that is still in from older versions?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am already at home now, but I am going to do some work on the weekend,&lt;/P&gt;&lt;P&gt;may be I can throw in a version 10 example and some stuff around this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Volker&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Nov 2011 16:41:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/executing-sql-queries-in-sap-gui-e-g-select-from-but000/qaa-p/8314195#M2958754</guid>
      <dc:creator>volker_borowski2</dc:creator>
      <dc:date>2011-11-25T16:41:03Z</dc:date>
    </item>
    <item>
      <title>Re: Executing SQL queries in SAP-GUI e.g. select * from but000</title>
      <link>https://community.sap.com/t5/technology-q-a/executing-sql-queries-in-sap-gui-e-g-select-from-but000/qaa-p/8314196#M2958755</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi again,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;here I have a "tail" of "desc SAPSR3.BKPF" on a system that was installed with ERP 6.0 four years ago&lt;/P&gt;&lt;P&gt;and got some SPs meanwhile:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
:
:
 SAMPLED                                   NOT NULL VARCHAR2(3)
 EXCLUDE_FLAG                              NOT NULL VARCHAR2(3)
 BLIND                                     NOT NULL VARCHAR2(3)
 OFFSET_STATUS                             NOT NULL VARCHAR2(6)
 OFFSET_REFER_DAT                          NOT NULL VARCHAR2(24)
 PENRC                                     NOT NULL VARCHAR2(6)
 KNUMV                                     NOT NULL VARCHAR2(30)
 VATDATE                                            VARCHAR2(24)
 XSPLIT                                             VARCHAR2(3)

SQL&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so the fields that did come in later do not have a NOT NULL (yet?).&lt;/P&gt;&lt;P&gt;This is one of our systems not yet upgraded to version 11.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Volker&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 26 Nov 2011 09:25:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/executing-sql-queries-in-sap-gui-e-g-select-from-but000/qaa-p/8314196#M2958755</guid>
      <dc:creator>volker_borowski2</dc:creator>
      <dc:date>2011-11-26T09:25:06Z</dc:date>
    </item>
    <item>
      <title>Re: Executing SQL queries in SAP-GUI e.g. select * from but000</title>
      <link>https://community.sap.com/t5/technology-q-a/executing-sql-queries-in-sap-gui-e-g-select-from-but000/qaa-p/8314197#M2958756</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Volker,&lt;/P&gt;&lt;P&gt;thanks for that real life example. Until now i have never seen such a behavior on (our) SAP systems, but as this a wanted behavior by SAP for prior 11g R2 database releases (regarding sapnote #1387135) it could be titled as "works-as-designed".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is even worse if you as a customer add some Z columns and want to index them in an OLTP environment (B*Tree indexes). It is some kind of blind flight, because of SAP is not continuous in this case. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am pretty sure that the ABAP developers are not aware of that database internals (B*Tree indexes contain no NULL values, if NULLABLE columns are indexed only).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again for pointing out this case - pretty awesome that we can learn new stuff from each other here every day &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Stefan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 26 Nov 2011 22:08:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/executing-sql-queries-in-sap-gui-e-g-select-from-but000/qaa-p/8314197#M2958756</guid>
      <dc:creator>stefan_koehler</dc:creator>
      <dc:date>2011-11-26T22:08:05Z</dc:date>
    </item>
    <item>
      <title>Re: Executing SQL queries in SAP-GUI e.g. select * from but000</title>
      <link>https://community.sap.com/t5/technology-q-a/executing-sql-queries-in-sap-gui-e-g-select-from-but000/qaa-p/8314198#M2958757</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Testcase:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
SQL&amp;gt; create table scott.testit 
     ( id number not null, 
       value1 varchar2(10) not null ) 
     tablespace DATA;
Table created.

SQL&amp;gt; desc scott.testit;
Name       Null?    Type
---------- -------- --------------------------------------------
 ID        NOT NULL NUMBER
 VALUE1    NOT NULL VARCHAR2(10)

SQL&amp;gt; insert into scott.testit (id,value1) values ( 1, 'Hello' );
1 row created.

SQL&amp;gt; commit;
Commit complete.

SQL&amp;gt; select * from scott.testit;
        ID VALUE1
---------- ----------
         1 Hello
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ADD COLUMN, the old fashioned way&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
SQL&amp;gt; alter table scott.testit add  ( ADDFIELD1 varchar2(5) );
Table altered.

SQL&amp;gt; desc scott.testit;
Name        Null?    Type
----------- -------- --------------------------------------------
 ID         NOT NULL NUMBER
 VALUE1     NOT NULL VARCHAR2(10)
 ADDFIELD1           VARCHAR2(5)

SQL&amp;gt; select * from scott.testit where ADDFIELD1 is null;

        ID VALUE1     ADDFI
---------- ---------- -----
         1 Hello
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Works as expected&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try to get NOT NULL and DEFAULT to work&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
SQL&amp;gt; alter table scott.testit modify ( ADDFIELD1 NOT NULL );
alter table scott.testit modify ( ADDFIELD1 NOT NULL )
*
ERROR at line 1:
ORA-02296: cannot enable (SCOTT.) - null values found

SQL&amp;gt; alter table scott.testit modify  ADDFIELD1 default '000';
Table altered.

SQL&amp;gt; alter table scott.testit modify ( ADDFIELD1 NOT NULL );
alter table scott.testit modify ( ADDFIELD1 NOT NULL )
*
ERROR at line 1:
ORA-02296: cannot enable (SCOTT.) - null values found
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;No suprise so far. You would usually need to update all NOT NULL&lt;/P&gt;&lt;P&gt;values to some values and you would be able to enable the NOT NULL constraint&lt;/P&gt;&lt;P&gt;allthough this may run for quite a while on big tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now lets try the new stuff&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
SQL&amp;gt; alter table scott.testit drop column ADDFIELD1;
Table altered.

SQL&amp;gt; alter table scott.testit ADD ADDFIELD1 varchar2(3) DEFAULT '000' not null;
Table altered.

SQL&amp;gt; desc scott.testit
Name        Null?    Type
----------- -------- --------------------------------------------
 ID         NOT NULL NUMBER
 VALUE1     NOT NULL VARCHAR2(10)
 ADDFIELD1  NOT NULL VARCHAR2(3)     &amp;lt;&amp;lt;&amp;lt;&amp;lt; BING !!!

SQL&amp;gt; select * from scott.testit;
        ID VALUE1     ADD
---------- ---------- ---
         1 Hello      000            &amp;lt;&amp;lt;&amp;lt;&amp;lt; Default '000' is working

SQL&amp;gt; select * from scott.testit where ADDFIELD1 is NULL;
no rows selected                     &amp;lt;&amp;lt;&amp;lt;&amp;lt; NOW this might be suprising

SQL&amp;gt; insert into scott.testit (id,value1,addfield1) values (2,'Bye', '000');
1 row created.

SQL&amp;gt; commit;                         &amp;lt;&amp;lt;&amp;lt;&amp;lt; Trying to compare "real" '000' with DEFAULT '000'
Commit complete.

SQL&amp;gt; select * from scott.testit;
        ID VALUE1     ADD
---------- ---------- ---
         1 Hello      000            &amp;lt;&amp;lt;&amp;lt;&amp;lt; Added with default
         2 Bye        000            &amp;lt;&amp;lt;&amp;lt;&amp;lt; inserted as '000'

SQL&amp;gt; alter table scott.testit modify ADDFIELD1 default '111';
Table altered.


SQL&amp;gt; select * from scott.testit;     &amp;lt;&amp;lt;&amp;lt;&amp;lt; Now it gets exciting
        ID VALUE1     ADD
---------- ---------- ---
         1 Hello      000            &amp;lt;&amp;lt;&amp;lt;&amp;lt; WOA... How does this work?
         2 Bye        000


SQL&amp;gt; set longC 20000 long 20000
SQL&amp;gt; select dbms_metadata.get_ddl('TABLE','TESTIT','SCOTT') from dual;

DBMS_METADATA.GET_DDL('TABLE','TESTIT','SCOTT')
----------------------------------------------------------------------------------

CREATE TABLE "SCOTT"."TESTIT"
 (  "ID" NUMBER NOT NULL ENABLE,
    "VALUE1" VARCHAR2(10) NOT NULL ENABLE,
    "ADDFIELD1" VARCHAR2(3) DEFAULT '111' NOT NULL ENABLE           &amp;lt;&amp;lt;&amp;lt;&amp;lt; No '000' DEFAULT
 ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "DATA"

SQL&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Looks like Oracle is at least a whole lot more clever than I expected.&lt;/P&gt;&lt;P&gt;It must have stored the first Default value somewhere else, as the documentation&lt;/P&gt;&lt;P&gt;says, that the effective rows will NOT be updated (otherwise it would never work so fast).&lt;/P&gt;&lt;P&gt;I need to dig into how datablocks are dumped and read.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just to finalize this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
SQL&amp;gt; alter table scott.testit modify ADDFIELD1 NULL;
Table altered.

SQL&amp;gt; select * from scott.testit;

        ID VALUE1     ADD
---------- ---------- ---
         1 Hello      000
         2 Bye        000

SQL&amp;gt; select * from scott.testit where addfield1 is null;
no rows selected

SQL&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;So the change persists even if you revert the constraint allthough the data&lt;/P&gt;&lt;P&gt;should not been changed. Surely need to do a datablock dump of this. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Need to do additional tests with indexes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But right now I am running out of time.&lt;/P&gt;&lt;P&gt;May be someone else likes to join the expedition.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Volker&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 27 Nov 2011 08:05:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/executing-sql-queries-in-sap-gui-e-g-select-from-but000/qaa-p/8314198#M2958757</guid>
      <dc:creator>volker_borowski2</dc:creator>
      <dc:date>2011-11-27T08:05:59Z</dc:date>
    </item>
    <item>
      <title>Re: Executing SQL queries in SAP-GUI e.g. select * from but000</title>
      <link>https://community.sap.com/t5/technology-q-a/executing-sql-queries-in-sap-gui-e-g-select-from-but000/qaa-p/8314199#M2958758</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;@Stefan&lt;/STRONG&gt;: &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;I am pretty sure that the ABAP developers are not aware of that database internals (B*Tree indexes contain no NULL values, if NULLABLE columns are indexed only).&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You absolutely right about that - and that is dangerous circumstance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thx a lot&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: thewesen on Nov 28, 2011 9:15 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Nov 2011 08:14:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/executing-sql-queries-in-sap-gui-e-g-select-from-but000/qaa-p/8314199#M2958758</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-11-28T08:14:49Z</dc:date>
    </item>
    <item>
      <title>Re: Executing SQL queries in SAP-GUI e.g. select * from but000</title>
      <link>https://community.sap.com/t5/technology-q-a/executing-sql-queries-in-sap-gui-e-g-select-from-but000/qaa-p/8314200#M2958759</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Volker and Stefan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks a lot four your replays. You did not answer my question but this is due to unspecific character of my question. And on the other hand I am happy you didn't, then otherwise I wouldn't have had a chance to learn about the SAP and DB internals. So thanks again.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;what I was actually looking for is a form of SQL command prompt in SAP CRM 7.1. I am looking for that because I am trying to validate CRM Segmentation( e.g. you got &lt;EM&gt;n&lt;/EM&gt; Customers and want write email to only ones that are located in xyz, so you use the Segment Builder and select the &lt;EM&gt;Segment&lt;/EM&gt; and so on...) so we are "selecting" (it is not SQL like selecting but a graphical user interface with small icons and boxes &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;) customers based on a field that can be empty or contain a char. We want go get all customers that do have a flag, so we select &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;field not ' '(blank)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; because blank is representing the NULL value. My problem is that this selection returns wrong numbers. so to validate I am using the SQ01 but there I am also not sure what this program is actually doing on the DB side. So to get certainty I thought about running true-SQL against the tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I could not imagine that there isn't a way to comfortable run SQLs in SAP  - by all the complexity.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PS.&lt;/P&gt;&lt;P&gt;I work for a big company with tight security regulations - so I cannot access the DB directly. &lt;SPAN __jive_emoticon_name="sad"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: thewesen on Nov 28, 2011 9:40 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Nov 2011 08:38:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/executing-sql-queries-in-sap-gui-e-g-select-from-but000/qaa-p/8314200#M2958759</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-11-28T08:38:53Z</dc:date>
    </item>
    <item>
      <title>Re: Executing SQL queries in SAP-GUI e.g. select * from but000</title>
      <link>https://community.sap.com/t5/technology-q-a/executing-sql-queries-in-sap-gui-e-g-select-from-but000/qaa-p/8314201#M2958760</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;at least, you could do a SE14 -&amp;gt; Check DB Object&lt;/P&gt;&lt;P&gt;which will show you, if you MIGHT need to deal with real DB-NULL values or not.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If all columns are NOT NUL, you might have different Problems.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Volker&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Nov 2011 11:04:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/executing-sql-queries-in-sap-gui-e-g-select-from-but000/qaa-p/8314201#M2958760</guid>
      <dc:creator>volker_borowski2</dc:creator>
      <dc:date>2011-11-28T11:04:22Z</dc:date>
    </item>
    <item>
      <title>Re: Executing SQL queries in SAP-GUI e.g. select * from but000</title>
      <link>https://community.sap.com/t5/technology-q-a/executing-sql-queries-in-sap-gui-e-g-select-from-but000/qaa-p/8314202#M2958761</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;what I was actually looking for is a form of SQL command prompt in SAP CRM 7.1.&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Well you got something like that .. from my previous reply: The full navigation path is "Transaction DBACOCKPIT -- Performance -- Additional Functions -- SQL Command Editor". You can write your own SQL like in SQL*Plus and run it on the database there.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you don't have a NULL issue here - you maybe hit the "prefetching" bug - depending on the used JOIN method and oracle version of course &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Stefan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Nov 2011 11:45:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/executing-sql-queries-in-sap-gui-e-g-select-from-but000/qaa-p/8314202#M2958761</guid>
      <dc:creator>stefan_koehler</dc:creator>
      <dc:date>2011-11-28T11:45:58Z</dc:date>
    </item>
    <item>
      <title>Re: Executing SQL queries in SAP-GUI e.g. select * from but000</title>
      <link>https://community.sap.com/t5/technology-q-a/executing-sql-queries-in-sap-gui-e-g-select-from-but000/qaa-p/8314203#M2958762</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;You right  DBACOCKPIT is the thing!&lt;/STRONG&gt; &lt;/P&gt;&lt;P&gt; I assumed this will be only available for SAP DBAs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;that is &lt;U&gt;GREAT!&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Nov 2011 13:03:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/executing-sql-queries-in-sap-gui-e-g-select-from-but000/qaa-p/8314203#M2958762</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-11-30T13:03:45Z</dc:date>
    </item>
    <item>
      <title>Re: Executing SQL queries in SAP-GUI e.g. select * from but000</title>
      <link>https://community.sap.com/t5/technology-q-a/executing-sql-queries-in-sap-gui-e-g-select-from-but000/qaa-p/8314204#M2958763</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks every body for help.&lt;/P&gt;&lt;P&gt;The transaction DBACOCKPIT has a SQL Command Editor (Performance &amp;gt; Additional Functions).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Nov 2011 13:08:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/executing-sql-queries-in-sap-gui-e-g-select-from-but000/qaa-p/8314204#M2958763</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-11-30T13:08:30Z</dc:date>
    </item>
  </channel>
</rss>

