Creating table with null and not null values.
I have to create a table with 5 Null nd 5 Not Null fields.My questionis which fields are place first?Not or Not Null and why???
What you mean is: the person who asked you the question thought the order of columns was important, and wanted to see if you agreed. Or maybe they were just asking the question to see whether you thought it was important (as a test of your understanding of the database).
When I started out in Oracle I was told that it was good practice to have the mandatory columns first and then the optional columns. But if you do some research you find this: the impact of column ordering on space management is: empty nullable columns at the end of the table take up zero bytes whereas empty nullable columns at the middle of the table take up one byte each. I think if that saving really is important to you you need to spring for an additional hard drive.
Besides, even if you do organise your columns as you suggest, what happens when you add an eleventh NOT NULL column to your table? It gets tacked on to the end of your table. Your whole neat organisation is blown.
What does still matter is the positioning of large VARCHAR2 columns: they should be the last columns on your table in case they create chaining. Then any query that doesn't need the large columns can be satisfied without reading the chained block, something that can't be guaranteed if you've got columns after a VARCHAR2(4000) column. This doesn't apply to CLOBs, etc. which are stored separately anyway.
Cheers, APC
Similar Messages
-
Order Of Null and Not Null Values while table creation
We have to create a table with 10 fields .5 of them are Null and Not Null. Now my question what should be the order of fileds??.Means Null Fields will come first or Not Null.
The only reason I can think of having the NULL columns at the end is storage space.
To conserve space, a null in a column only stores the column length (zero). Oracle
does not store data for the null column. Also, for trailing null columns, Oracle does
not even store the column length. -
Using NULL and NOT NULL in prompted filters
Dear all,
While trying to grap the concept of prompted filters in sap bo web intelligence, I had a question whether why we cannot use NULL and NOT NULL while creating a prompted filters in our report.HI,
'Is Null' and 'Not Null' are the predefined functions in webi which only eliminate the null values or considering only null values.
'Is Null' and 'Not Null' are itself predefined functions that why you are not getting prompts.
Null values are standard across the databases so this is defined as a function in webi to specific eliminate the null values.
If something is not standard then there is option in the webi to use different operator with static values or with prompts.
More more information on Null see the Null wiki page.
Null (SQL) - Wikipedia, the free encyclopedia
Amit -
How can I set my WebI filters to Null and not Null
Folks,
I have created a report in WebI and now I am to set up some filters as Null and some Not Null.
How can I set my WebI filters to Null and not Null?
Regards,
Bashir AwanHi,
As you said you could do it at the report level and also at the universe level.
One more way is to create the filters in the universe levele and add them in thequery filter.
Ex: in the filter you need to write :
Column1 is null and and column 2 is not null etc.
Hope this will help.
If this did't solve your problem then please explain it in detail.
Cheers,
Ravichandra K -
How to create table with rows and columns in the layout mode?
One of my friends advised me to develop my whole site on the
layout mode as its better than the standard as he says
but I couldnot make an ordinary table with rows and columns
in th layout mode
is there any one who can tell me how to?
thanx alotYour friend is obviously not a reliable source of HTML
information.
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com
- Template Triage!
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
http://www.macromedia.com/support/search/
- Macromedia (MM) Technotes
==================
"Mr.Ghost" <[email protected]> wrote in
message
news:f060vi$npp$[email protected]..
> One of my friends advised me to develop my whole site on
the layout mode
> as its
> better than the standard as he says
> but I couldnot make an ordinary table with rows and
columns in th layout
> mode
> is there any one who can tell me how to?
> thanx alot
> -
How to create table with javascript and jquery in abap
Hello masters,
i want to create table using javascript and jquery.
i know how to use these languages but i dont how to implement them to abap.
regards.Look at the sample BSP application SBSPEXT_HTMLB
also you can look at the below Blog..
/people/brian.mckellar/blog/2003/10/31/bsp-programming-htmlb-tableview-iterator
<i>*Reward each useful answer</i>
Raja T -
Create table with constraint and index
If I create a table with constraint key; after that I create an unique index key, I got an error. Please see below.
Does it mean when I create a table with constraint the unique index are automatically created and I could not create
index key as I did as below?
create table test_const(ename varchar2(50) not null,
key_num number not null,
descr varchar2(100),
constraint constraint_test_const unique (ename, key_num));
create unique index test_const_idx on test_const
"ENAME","KEY_NUM"
tablespace tmp_data;
Error report:
SQL Error: ORA-01408: such column list already indexed
*01408. 00000 - "such column list already indexed"*Not too hard to check (the answer is yes by the way).
ME_XE?create table test_const(ename varchar2(50) not null,
key_num number not null,
descr varchar2(100),
constraint constraint_test_const unique (ename, key_num));
2 3 4
Table created.
Elapsed: 00:00:00.12
ME_XE?select index_name, index_type
from user_indexes where table_name = 'TEST_CONST';
2
INDEX_NAME INDEX_TYPE
CONSTRAINT_TEST_CONST NORMAL
1 row selected.
Elapsed: 00:00:00.14
ME_XE? -
Hi,
I want to specify that if an ID is 0 or null to do something... I am not sure if I am writing the code properly since it does not display anything when the coulmn has data(not null)
<%! int ID=1;%>
<% if ((ID ==0) || (request.getParameter("ID") !=null)){ %>
do something
<%} else {%>
do something else
<%%>
if the ID is has a number greater than 0 then I would like to display information. But my code does not get to the else statement?
Thanks!Remember the functionality of logical OR operator. IF the first statement evaluated is TRUE, the next are not evaluated.
-
How to create table with rows and columns in HTMLB
Hello All,
Can any one tell me how to create table in HTMLB?
Regards,
Lisa.Look at the sample BSP application SBSPEXT_HTMLB
also you can look at the below Blog..
/people/brian.mckellar/blog/2003/10/31/bsp-programming-htmlb-tableview-iterator
<i>*Reward each useful answer</i>
Raja T -
Checking null and not null values
Hi!
We have a job schedule table that has a column for each day.
JOB_ID, TIME_ID, MO, TU, WE, TH, FR, SA, SU
1 1 X
1 2 XSince the same job can be on different days and times, we need to check all the instances of
that job.
Sorry for the formatting - the X is an indicator; i.e. Wednesday and Saturday.
How can we solve this?
Thanks!Your requirements are not really clear.
Perhaps this query could help:
-- Your Data:
with yourtable as
select 1 job_id, 1 time_id, null mo, null tu, 'X' we, null th, null fr, null sa, null su from dual union all
select 1 job_id, 2 time_id, null mo, null tu, null we, null th, null fr, null sa, 'X' su from dual
-- Query:
select job_id, time_id, 'mo' day from yourtable where to_char(mo)='X' union all
select job_id, time_id, 'tu' day from yourtable where to_char(tu)='X' union all
select job_id, time_id, 'we' day from yourtable where to_char(we)='X' union all
select job_id, time_id, 'th' day from yourtable where to_char(th)='X' union all
select job_id, time_id, 'fr' day from yourtable where to_char(fr)='X' union all
select job_id, time_id, 'sa' day from yourtable where to_char(sa)='X' union all
select job_id, time_id, 'su' day from yourtable where to_char(su)='X'Edited by: hm on 29.07.2011 01:40
Edited by: hm on 29.07.2011 01:41 -
MS SQL Server 2014: Error inserting into Temp table with index and identity field
In this thread, I mentioned a problem with SQL Server 2014:
SQL Server 2014: Bug with IDENTITY INSERT ON
The question was answered, it is a bug. To keep you informed on this issue, I open this discussion.
Problem:
The code below works perfectly fine on MS SQL Server 2008 R2 and MS SQL Server 2012, but gives an error every second time the proc is executed on MS SQL Server 2014. If I do not define any index on the temp table, the problem disappears. Defining the index
after the insert, does not help.
SET NOCOUNT ON
GO
IF EXISTS (SELECT 1 FROM sys.procedures WHERE name = 'usp_Test') DROP PROC dbo.usp_Test;
GO
CREATE PROC dbo.usp_Test AS
BEGIN
SET NOCOUNT ON
CREATE TABLE #Source(ID integer NOT NULL);
INSERT INTO #Source VALUES (1), (2), (3);
CREATE TABLE #Dest (ID integer IDENTITY(1,1) NOT NULL);
CREATE INDEX #IDX_Dest ON #Dest (ID);
PRINT 'Check if the insert might cause an identity crisis';
SELECT 'Source' AS SourceTable, * FROM #Source;
SELECT 'Destination' AS DestTable, * FROM #Dest;
SET IDENTITY_INSERT #Dest ON;
PRINT 'Do the insert';
INSERT INTO #Dest (ID) SELECT ID FROM #Source;
PRINT 'Insert ready';
SET IDENTITY_INSERT #Dest OFF;
SELECT * FROM #Dest;
DROP TABLE #Source;
DROP TABLE #Dest;
END;
GO
PRINT 'First execution of the proc, everything OK';
EXEC dbo.usp_Test;
PRINT '';
PRINT 'Second execution of the proc, the insert fails.';
PRINT 'Removing the index #IDX_Dest causes the error to disappear.';
EXEC dbo.usp_Test;
GO
DROP PROC dbo.usp_Test;
GOThere is some progress. Communication from a former Microsoft employee tells us this:
Shivendra Vishal
Engineer at Microsoft
I am no longer with MS, and I do not have code access, however from the public symbols, I could make out following:
sqlmin!SetidentI2I4+0x1f3:
000007fe`f4d865d3 488b10 mov rdx,qword ptr [rax] ds:00000000`00000000=????????????????
ExceptionAddress: 000007fef4d865d3 (sqlmin!SetidentI2I4+0x00000000000001f3)
ExceptionCode: c0000005 (Access violation)
ExceptionFlags: 00000000
NumberParameters: 2
Parameter[0]: 0000000000000000
Parameter[1]: 0000000000000000
Attempt to read from address 0000000000000000
This is a read AV and from registers it is clear that we were trying to move the value of location pointed by qword of register rax which is not valid:
rax=0000000000000000 rbx=0000000000000038 rcx=0000000000001030
rdx=0000000000000006 rsi=00000001f55def98 rdi=00000000106fd070
rip=000007fef4d865d3 rsp=00000000106fcf40 rbp=00000000106fcfe9
r8=0000000000000000 r9=00000001f55def60 r10=00000001f55defa0
r11=00000000106fcd20 r12=0000000000000000 r13=0000000000000002
r14=00000001f49c3860 r15=00000001f58c0040
iopl=0 nv up ei pl nz na po nc
cs=0033 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00010206
The stack is:
# Child-SP RetAddr Call Site
00 00000000`106fcf40 000007fe`f30c1437 sqlmin!SetidentI2I4+0x1f3
01 00000000`106fd050 000007fe`f474e7ce sqlTsEs!CEsExec::GeneralEval4+0xe7
02 00000000`106fd120 000007fe`f470e6ef sqlmin!CQScanUpdateNew::GetRow+0x43d
03 00000000`106fd1d0 000007fe`f08ff517 sqlmin!CQueryScan::GetRow+0x81
04 00000000`106fd200 000007fe`f091cebe sqllang!CXStmtQuery::ErsqExecuteQuery+0x36d
05 00000000`106fd390 000007fe`f091ccb9 sqllang!CXStmtDML::XretDMLExecute+0x2ee
06 00000000`106fd480 000007fe`f08fa058 sqllang!CXStmtDML::XretExecute+0xad
07 00000000`106fd4b0 000007fe`f08fb66b sqllang!CMsqlExecContext::ExecuteStmts<1,1>+0x427
08 00000000`106fd5f0 000007fe`f08fac2e sqllang!CMsqlExecContext::FExecute+0xa33
09 00000000`106fd7e0 000007fe`f152cfaa sqllang!CSQLSource::Execute+0x86c
0a 00000000`106fd9b0 000007fe`f152c9e8 sqllang!CStmtExecProc::XretLocalExec+0x25a
0b 00000000`106fda30 000007fe`f152a1d8 sqllang!CStmtExecProc::XretExecExecute+0x4e8
0c 00000000`106fe1e0 000007fe`f08fa058 sqllang!CXStmtExecProc::XretExecute+0x38
0d 00000000`106fe220 000007fe`f08fb66b sqllang!CMsqlExecContext::ExecuteStmts<1,1>+0x427
0e 00000000`106fe360 000007fe`f08fac2e sqllang!CMsqlExecContext::FExecute+0xa33
0f 00000000`106fe550 000007fe`f0902267 sqllang!CSQLSource::Execute+0x86c
10 00000000`106fe720 000007fe`f0909087 sqllang!process_request+0xa57
11 00000000`106feee0 000007fe`f2bf49d0 sqllang!process_commands+0x4a3
12 00000000`106ff200 000007fe`f2bf47b4 sqldk!SOS_Task::Param::Execute+0x21e
13 00000000`106ff800 000007fe`f2bf45b6 sqldk!SOS_Scheduler::RunTask+0xa8
14 00000000`106ff870 000007fe`f2c136ff sqldk!SOS_Scheduler::ProcessTasks+0x279
15 00000000`106ff8f0 000007fe`f2c138f0 sqldk!SchedulerManager::WorkerEntryPoint+0x24c
16 00000000`106ff990 000007fe`f2c13246 sqldk!SystemThread::RunWorker+0x8f
17 00000000`106ff9c0 000007fe`f2c13558 sqldk!SystemThreadDispatcher::ProcessWorker+0x3ab
18 00000000`106ffa70 00000000`775d59ed sqldk!SchedulerManager::ThreadEntryPoint+0x226
19 00000000`106ffb10 00000000`7780c541 kernel32!BaseThreadInitThunk+0xd
1a 00000000`106ffb40 00000000`00000000 ntdll!RtlUserThreadStart+0x21
Unassembling the function:
000007fe`f4d8658e 4c8b10 mov r10,qword ptr [rax]
000007fe`f4d86591 4533e4 xor r12d,r12d
000007fe`f4d86594 410fb7d5 movzx edx,r13w
000007fe`f4d86598 4533c9 xor r9d,r9d
000007fe`f4d8659b 4533c0 xor r8d,r8d
000007fe`f4d8659e 488bc8 mov rcx,rax
000007fe`f4d865a1 4489642420 mov dword ptr [rsp+20h],r12d
000007fe`f4d865a6 41ff5230 call qword ptr [r10+30h]
000007fe`f4d865aa 8b5597 mov edx,dword ptr [rbp-69h]
000007fe`f4d865ad 4c8b10 mov r10,qword ptr [rax]
000007fe`f4d865b0 4489642438 mov dword ptr [rsp+38h],r12d
000007fe`f4d865b5 4489642430 mov dword ptr [rsp+30h],r12d
000007fe`f4d865ba 458d442401 lea r8d,[r12+1]
000007fe`f4d865bf 4533c9 xor r9d,r9d
000007fe`f4d865c2 488bc8 mov rcx,rax
000007fe`f4d865c5 c644242801 mov byte ptr [rsp+28h],1
000007fe`f4d865ca 4488642420 mov byte ptr [rsp+20h],r12b
000007fe`f4d865cf 41ff5250 call qword ptr [r10+50h]
000007fe`f4d865d3 488b10 mov rdx,qword ptr [rax] <=================== AV happened over here
000007fe`f4d865d6 488bc8 mov rcx,rax
000007fe`f4d865d9 4c8bf0 mov r14,rax
000007fe`f4d865dc ff5268 call qword ptr [rdx+68h]
000007fe`f4d865df 488d55e7 lea rdx,[rbp-19h]
000007fe`f4d865e3 4c8b00 mov r8,qword ptr [rax]
000007fe`f4d865e6 488bc8 mov rcx,rax
000007fe`f4d865e9 41ff5010 call qword ptr [r8+10h]
000007fe`f4d865ed f6450a04 test byte ptr [rbp+0Ah],4
I remember few issues with scan2ident function, I am not sure if they have fixed it however it appears that this is intoduced to SQL 2014 and we need help from MS to get this resolved as it needs code analysis.
It is not getting simulated for other versions of SQL apart from SQL 2014.
Also to add, interestingly, the value of rax is not visibly changed and it was successfully passed on to rcx, which has a valid value, so something should have changed the value of rax inside call to function using call qword ptr [r10+50h], and looking at this
it appears that it might be a list of functions and we are going at particular offset [50h]. So, bottom line is that the call to function qword ptr [r10+50h], should be changing something in rax, and debugging/analyzing this code might give us some more idea. -
Script or query to generate a report of null or not null columns
I need a script/query it should pick up all the tables from user_tab_columns and produce a report for all the tables which are the columns are null and not null.
As long as the columns were defined as NOT NULL on table create, or ALTERed NOT NULL, you can do this:
SQL> CREATE TABLE t (id NUMBER NOT NULL, descr VARCHAR2(10));
Table created.
SQL> SELECT column_name, table_name, nullable
2 FROM user_tab_columns
3 WHERE table_name = 'T';
COLUMN_NAME TABLE_NAME N
ID T N
DESCR T Y
SQL> ALTER TABLE t modify (descr NOT NULL);
Table altered.
SQL> SELECT column_name, table_name, nullable
2 FROM user_tab_columns
3 WHERE table_name = 'T';
COLUMN_NAME TABLE_NAME N
ID T N
DESCR T NNote that if you do:
ALTER TABLE t ADD CONSTRAINT id_nn CHECK (id IS NOT NULL);then the nullable column in xxx_tab_columns will remain as Y.
HTH
John -
Unable to create table with column default value with date interval
Please help to create table with calculated date defaullt value:
CREATE TABLE emp (
birth_date DATE DEFAULT sysdate + interval '3' day NOT NULL
or
CREATE TABLE emp (
some_date DATE,
birth_date DATE DEFAULT some_date NOT NULL
or
CREATE TABLE emp (
some_date DATE,
birth_date DATE DEFAULT some_date + interval '3' day NOT NULL
below syntax error:
TT1001: Syntax error in SQL statement before or at: "+"I'm afraid this is not possible; as per the SQL Reference, TimesTen only supports 'constant expressions' for the DEFAULT clause and none of these are constant expressions.
Chris -
How to Create a Table with Merge and partitions in HANA
Hi,
What is the best way to create a Table with MERGE and PARTITION and UNLOAD PRIORITIES.
Any body can you please give me some examples.
Regards,
DevaOk,
1) the UNLOAD PRIORITY has nothing to do with the order of data loads in your ETL process
2) Unloading of columns will happen automatically. Don't specify anything specific for the tables, then SAP HANA will take care about it
3) Not sure where you get your ideas from, but there is no need to manually "flush" tables or anything like that. SAP HANA will take care of memory housekeeping.
4) Partitioning and how to specify it for tables has been largely documented. Just read up on it.
5) Delta Merge will happen automatically, as long as you don't prevent it (e.g. by trying to outsmart the mergedog rules)
Seriously, I get the impressions that this list of requirements is based on some hear-say and lack of actual information and experience with SAP HANA. There are a couple of extensive discussions on data loading optimization available here in SCN and on SAPHANA.COM. Please read those first.
All this had been discussed broadly a couple of times.
- Lars -
my iCal calendar that I created with the color green keeps changing to purple. no matter how many times I change it to green, it turns it back to purple. Of course this only happens with iCloud and not "from my Mac". Any ideas on how to correct this? This seems like a trivial error, but it's super annoying.
I called Apple and they said that they know about this problem. It's a problem with iCloud which their Engineers know about. (there was a new iCloud release, hence...) No ETA for a fix yet. I asked that this be escalated so Engineering doesn't put it at the bottom of their fix list. I talked to a Senior Advisor and mentioned to them to have QA check their regression tests as this has happened before to me (the problem just didn't take this long to resolve). I like to use green too for important stuff, so I've resorted to creating a new calendar using the normal calendar green for events going forward. They could have picked another color besides green to have this problem with and I wouldn't have been so upset. ;-)
Maybe you are looking for
-
I have just set up my children as family members in IOS8 and set the wrong DOB for my son (Phone rang while I was doing it...can't multitask...you know how it is.) And he will be upset when it tells him he is 5 and no doubt poor lad will have complic
-
Audit types which are configured not found while creating Audit
Hi Experts, Please help me to solve the below problem- I have configured new Audit types in Audit managment. But while creating Audit in transaction PLMD_AUDIT, I could not find these in drop down of Audit type. How to rectify this problem? Thanks in
-
Entry of non-English characters into the db
Hi We are facing a problem in inserting non-English characters into the database.For example, we have a company name field which can accept German characters. This field has been defined as of varchar2 type of size 50 in the db. When we enter 49 Engl
-
I forgot to ask - What the He** is an OZONE Plugin! And where can I find that darned thing so I can throw it away!!!! Jerry Wills
-
Instance not found in BPEL Console until Process finished
I have two services on the server, where one (asynchronous) service is calling another (synchronous) service multiple times. WHen creating an instance in the BPEL Console, this instance is nowhere to be found. When trying to see the flow, an error me