User_tab_cols - nullable column?
Dear All,
check the workflow:
C:\>sqlplus scott/tiger
SQL*Plus: Release 10.2.0.1.0 - Production on Fri Apr 4 16:20:48 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> CREATE TABLE TEST
2 (ID NUMBER(*,0))
3 /
Table created.
SQL>
SQL> ALTER TABLE TEST ADD (CONSTRAINT TEST_ID_NOT_NULL CHECK (ID IS NOT NULL) EN
ABLE)
2 /
Table altered.
SQL>
SQL> DESC TEST
Name Null? Type
ID NUMBER(38)
SQL>
SQL> -- Null? -> NULL
SQL>
SQL> SELECT TABLE_NAME
2 ,NULLABLE
3 FROM USER_TAB_COLS
4 WHERE TABLE_NAME = 'TEST'
5 /
TABLE_NAME N
TEST Y
SQL>
SQL> -- Nullable? Since when? I've declared a constraint on it. Ok, let's try:
SQL>
SQL> INSERT INTO TEST (ID) VALUES (NULL)
2 /
INSERT INTO TEST (ID) VALUES (NULL)
ERROR at line 1:
ORA-02290: check constraint (SCOTT.TEST_ID_NOT_NULL) violated
SQL>
SQL> -- True, I have a check constraint on the ID.
SQL> -- But why is the column nullable if I check the user_tab_cols?
SQL> -- I don't see the difference between forcing Oracle to add
SQL> -- constraints automatically at creation time
SQL> -- (create table test (id number not null)) and
SQL> -- adding constraints manually... It will use constraints
SQL> -- anyway...
SQL>
SQL> -- Don't forget to clean up!
SQL> DROP TABLE TEST CASCADE CONSTRAINTS
2 /
Table dropped.
SQL>
Any thoughts?
Thanks,
Franky
Franky,
Oracle has worked this way for as long as I can remember. Observe
UT1 > create table t1 (col1 varchar2(10) not null);
Table created.
UT1 > desc t1
Name Null? Type
COL1 NOT NULL VARCHAR2(10)
UT1 > select search_condition from dba_constraints where table_name = 'T1';
SEARCH_CONDITION
"COL1" IS NOT NULL
UT1 > drop table t1
2 /
Table dropped.
UT1 > create table t1 (col1 varchar2(10) );
Table created.
UT1 > desc t1
Name Null? Type
COL1 VARCHAR2(10)
1* alter table t1 add (Constraint t1col1 check (col1 is not null))
UT1 > /
Table altered.
UT1 > desc t1
Name Null? Type
COL1 VARCHAR2(10)
1* select search_condition from dba_constraints where table_name = 'T1'
UT1 > /
SEARCH_CONDITION
col1 is not nullUsing the "not null" keywords in the create table results in Oracle setting a switch as being turned on. It is this setting that describe reads for the table not null column. But in both cases dba_constraints will show a check constraint.
It is just the way it is. I suggest using the "not null" key words on the table create rather than setting explicit column level constraints for the columns.
I just noticed that in the first case that the column name is in double quotes in the search condition and is the second it is not.
HTH -- Mark D Powell --
Similar Messages
-
Reg: Nullable column search
Hi all,
I have a table DIAGNOSIS which has a QDESC as a nullable column.
columns DIAGCODE and SDESC are not nullable.
I have written a Stored Procedure to retrieve records from DIAGNOSIS table based on the columns values specified.
p_<column_name> indicates the parameter passed to the Stored Procedure
The correspong SQL statement goes as follows.
SELECT * FROM DIAGNOSIS
WHERE
UPPER(DIAGCODE) LIKE
(CASE WHEN LENGTH(p_DIAGCODE) > 0 THEN '%' || UPPER(p_DIAGCODE) || '%' ELSE '%' END)
AND UPPER(SDESC) LIKE
(CASE WHEN LENGTH(p_SDESC) > 0 THEN '%' || UPPER(p_SDESC) || '%' ELSE '%' END)
-- QDESC is a nullable field; but the following logic doesnt work :-(
AND UPPER(QDESC) LIKE
(CASE WHEN LENGTH(p_QDESC) > 0 THEN '%' || UPPER(p_QDESC) || '%' ELSE '%' END)
Sample data of the table is as follows.
DIAGCODE SDESC QDESC
123 DESC 1 AAA
123 DESC 2
123 DESC 3 BBB
123 DESC 4
When I use the above query to find records with DIAGCODE as 123, I get
DIAGCODE SDESC QDESC
123 DESC 1 AAA
123 DESC 3 BBB
i.e QDESC with null values are not displayed.
How am I supposed to modify the query to get the correct result?
Any help would be highly appreciated.
Thanks n Regards,
TanujaLet's assume the formal parameter is called p_column_name.
The actual content of that parameter is 'DIAGCODE' or 'Q_DESC' or whatever.
In static sql
you can only have
<column_name> = <constant>
and <constant> can be replaced by a bind variable.
This construct
select *
from <table>
where p_column_name is null
is not going to work, as there is no p_column_name in that table.
This construct
declare
dynstr varchar2(100);
p_dummy varchar2(100);
p_column_name varchar2(30);
begin
p_column_name := 'bar';
dynstr := 'select bar from foo where '||p_column_name||' is null';
execute immediate dynstr into p_dummy;
end;
although silly dummy code is going to work.
Hth
Sybrand Bakker
Senior Oracle DBA -
NULLABLE column is not updated after the NOT NULL constraint definition...
Hi,
SQL> select column_name,nullable from all_tab_columns where table_name='EMP';
COLUMN_NAME NULLABLE
EMPNO N
ENAME Y
JOB Y
MGR Y
HIREDATE Y
SAL Y
COMM Y
DEPTNO Y
CODE_POLEIS_DIAM Y
9 rows selected
SQL> ALTER TABLE EMP add constraint emp_job_nn check(job is not null);
Table altered
SQL> select constraint_name from all_cons_columns
2 where table_name='EMP';
CONSTRAINT_NAME
FK_DEPTNO
PK_EMP
EMP_JOB_NN
SQL> select column_name,nullable from all_tab_columns where table_name='EMP';
COLUMN_NAME NULLABLE
EMPNO N
ENAME Y
JOB Y <---------'NULL'
MGR Y
HIREDATE Y
SAL Y
COMM Y
DEPTNO Y
CODE_POLEIS_DIAM Y
9 rows selected
Why is not updated....????
In Oracle ebook:
Oracle® Database Reference
10g Release 2 (10.2)
Part Number B14237-02
the comments about the NULLBLE column are as follows:
"Specifies whether a column allows NULLs. Value is N if there is a NOT NULL constraint on the column or if the column is part of a PRIMARY KEY. The constraint should be in an ENABLE VALIDATE state."
BUT BY DEFAULT ALL CONSTRAINTS ARE IN VALIDATE STATE
(Ref: Oracle® Database SQL Reference
10g Release 2 (10.2)
Part Number B14200-02 )Note : I use OraDB 10g v.2
Thanks a lot
SimHi,
Tom Kytes answer it before:
SQL> create table t ( id int );
Table created.
SQL> desc t
Name Null? Type
ID NUMBER(38)
SQL> alter table t add constraint t_nn check (id is not null);
Table altered.
SQL> insert into t (id) values (null);
insert into t (id) values (null)
ERROR at line 1:
ORA-02290: check constraint (TANDREWS.T_NN) violated
SQL> desc t
Name Null? Type
ID NUMBER(38)
Followup July 16, 2003 - 10am US/Eastern:
that is not a NOT NULL constraint, that is a check constraint
ops$tkyte@ORA920LAP> create table t ( x int );
Table created.
ops$tkyte@ORA920LAP> alter table t modify x not null;
Table altered.
ops$tkyte@ORA920LAP> set linesize 50
ops$tkyte@ORA920LAP> desc t
Name Null? Type
X NOT NULL NUMBER(38)To see the full thread in asktom, please refer to:
- http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:1338402651192
Cheers,
Francisco Munoz Alvarez
http://www.oraclenz.com -
If we need to insert blank into a non nullable char and varchar fields
what should we do. And in case of int and decimal fields can we insert
0 and 0.0
ThanksIf you need to insert blank then you should insert
blank. It makes no difference whether the column
accepts null values or not because blank is not null.That is not entirely true. With Oracle a String of the length zero will be treated as a null value. -
Creating a foreign constraint on a nullable column.
hi,
for example I am having a table x with columns(id primary key, no number,name,address);
another table y in operapps schema with columns ( id primary key,code not null,desg);
i want to create foreign key constraint as
ALTER TABLE x ADD ( FOREIGN KEY (no) REFERENCES OPERAPPS.y(ID));
this is erroring out as no column in table x can be null,and the messge is
ORA-02298: cannot validate (SAFEX_DEV.SYS_C0081362) - parent keys not found.
Please advice.The error message is telling you that there are values in the proposed FK column that are not found in the parent table, not that there is a problem with nulls.
-
OSB10.3.1 fn-bea:execute-sql - nullable columns and type conversion
Hi all,
we are using the fn-bea:execute-sql function to retrieve data from an Oracle db:
<ctx:route><ctx:service>{
fn-bea:execute-sql (
fn:concat(xs:string($body/urn:clientDataLookup/ds/text()),'.SADataSource'),
'resultset',
'SELECT id, name, type_id, domi_country_id, open_date, close_date FROM my_table WHERE id=?',
xs:string($body/urn:clientDataLookup/id/text())
</ctx:service></ctx:route>
Where my_table is defined as below:
CREATE TABLE my_table
ID NUMBER,
NAME VARCHAR2(100 BYTE),
TYPE_ID NUMBER,
DOMI_COUNTRY_ID NUMBER,
OPEN_DATE DATE,
CLOSE_DATE DATE,
As you can see ID,TYPE_ID,DOMI_COUNTRY_ID are defined as NUMBER and some columns could be null.
Below an example of the result from the above query using fn-bea:execute-sql function:
<resultset>
<ID>161052.0</ID>
<NAME>...</NAME>
<TYPE_ID>3.0</TYPE_ID>
<DOMI_COUNTRY_ID>2090.0</DOMI_COUNTRY_ID>
<OPEN_DATE>2010-12-17T00:00:00</OPEN_DATE>
</resultset>
In the above example the column CLOSE_DATE is null for the given ID and the CLOSE_DATE tag, as you can see, is not included in the result.
In addition the values for the columns defined as NUMBER are returned with decimals.
Is there any way to return also tags for columns that are NULL ? E.g. something like <CLOSE_DATE null="Y"/> ?
And for the columns defined as NUMBER that are returned with decimals what could we do to force the type without decimals ?
We are wondering if fn-bea:execute-sql function accepts any extra param in order 'to drive' result format/structure ... as expected ...
Thanks in advance
ferpIt sounds like a bug. Can you please contact bea support?
Gregory Haardt
ALSB Prg. Manager
[email protected] -
How to find out the NULL columns in the table?
Hi,
Please provide the query to find the null columns in the table. Here, all rows in the table have same column as null. It won't change.
Table
c1 c2 c3 c4
X C 10
T D 20
I wanna find out as C2 is the nullable column.
Thanks in advance !!
Regards,
Vissu....Below code might be solution for finding NULL valued in columns in a table and if it is solution .kindly give me points for the same.
declare
cursor col_cur is
select column_name
from user_tab_cols -- all_tables can also be used in case the table is present in own schema
where table_name = 'TABLE_NAME'; --provide the TABLE_NAME
stmt varchar2(1000):= '';
v_count number;
count_null number;
begin
execute immediate 'select count(*) from TABLE_NAME' into v_count; --provide the TABLE_NAME
for rec in col_cur loop
execute immediate 'select count(*) from TABLE_NAME' where --provide the TABLE_NAME
'||rec.column_name||' IS NULL' into count_null;
if count_null = v_count then
stmt :=stmt|| rec.column_name ||chr(13);
end if;
end loop;
dbms_output.put_line(stmt);
end ; -
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 -
How To know Which Columns are not null and Which are null
Hi Freinds,
I want to Know ,How by Wrting a Query we can get the Names of The Columns from the Table which is set to not-null or null,
Thanks
ShoaibSELECT * FROM user_tab_columns
WHERE table_name='Your_Table_Name'Check NULLABLE column. -
FindByAltKey() is not working properly with the nullable elemens in the Key
HI
I am facing a problem while using findByAltKey(). I have an alternate key in my Entity Object with few nullable/non nullable columns.
When I call finidByAltKey() with the key as a combination of non nullable columns It is working fine , that means the row iterator has some elements if that key exists in the Database.
When I call findByAltKey() with the key as combination of nullable columns It is not working, that means the row iterator does not have any elements
Key key = new Key(new Object[]
{ dataBean.getCapability(),dataBean.getFeasibilityFlag(),dataBean.getLineOfBusiness(),dataBean.getPriority(),dataBean.getDesGeoBegValue(),dataBean.getDesGeoEndValue(),dataBean.getDesGeoType(),dataBean.getOriGeoBegValue(),dataBean.getOriGeoEndValue(),dataBean.getOriGeoType() });
RowIterator rows = vo.findByAltKey("NetworkFeasibilityAltKey",key,2,false);
System.out.println(rows.hasNext());
if(!rows.hasNext()){
// Do this
}else {
// Do something else
rows.hasNext() always givine me false value eventhough that key exists
When I commit the row I am getting below exception
oracle.jbo.TooManyObjectsException: JBO-28204: Too many objects match the alternate key oracle.jbo.Key[DEDS N DEDC 1 NJ null ST DEPERE null CT ] for entity sni.nm.model.entities.NetworkFeasibilityEO, key NetworkFeasibilityAltKey.
I suspect null values are creating some problem...'''McAfee Site Advisor:''' https://support.mozilla.com/questions/837419
Look for an updated version in about the 3rd week of July; hopefully they'll fix their many other errors besides, I don't think I've been able to use it since about Firefox 3.6.0 or maybe 3.6.6
Be aware that if you currently choose to use McAfee Site Advisor it has some serious problems for Firefox users, check
*http://kb.mozillazine.org/Problematic_extensions for some things to watch out for.
*https://support.mozilla.com/questions/837877
*https://community.mcafee.com/message/195191 -
Data type column size does not match size of values returned
I've tried searching but couldn't find what I was looking for, sorry if this has been answered or is a duplicate.
I am using the (Java) method below to get the column definitions of a table. I am doing this through an ODBC connection (using Oracle ODBC driver) and I have NO CHOICE in the matter.
The problem I am having is that one particular column has a column size is smaller than the size of the data it purportedly holds (ie attendance_code = varchar size 3 but data value is "Absent". I suspect the data is actually a look up to situation, where my attendance_code column has a value of 'ABS' and Oracle goes and fetchs the "Absent" value.
My issue is that the meta data returned from ODBC is the actual column definition (ie varchar(3) and not varchar2(10) for example).
The resultset metadata has a size of 3 for the column in question, and querying the schema also yields 3 for that column.
How do I resolve this? I do not have access to all_columns table etc. I have to do it using ODBC metadata only.
I've tried recreating the situation using the Oracle XE DB, but as I am not familiar with Oracle, I do not know how to recreate this scenario (which would then lead me to test other options with ODBC).
TIA.
The select I am using is SELECT * FROM <tableName>.
public ArrayList<SchemaColumn> getColumnsForTable(String catalog,
String schema,
String tableName) {
ArrayList<SchemaColumn> columns = new ArrayList<SchemaColumn>();
ResultSet rs = null;
try {
DatabaseMetaData metaData = connection.getMetaData();
rs = metaData.getColumns(catalog, schema, tableName, "%");
SchemaColumn column;
while (rs.next()) {
column = new SchemaColumn();
column.setName(rs.getString("COLUMN_NAME"));
column.setDataType(rs.getInt("DATA_TYPE"));
column.setTypeName(rs.getString("TYPE_NAME"));
column.setColumnSize(rs.getInt("COLUMN_SIZE")); <-------- this is the value that is coming back smaller than the data it actually returns
column.setDecimalDigits(rs.getInt("DECIMAL_DIGITS"));
column.setNumPrecisionRadix(rs.getInt("NUM_PREC_RADIX"));
column.setNullable(rs.getInt("NULLABLE"));
column.setRemarks(rs.getString("REMARKS"));
column.setDefaultValue(rs.getString("COLUMN_DEF"));
column.setSqlDataType(rs.getInt("SQL_DATA_TYPE"));
column.setSqlDateTimeSub(rs.getInt("SQL_DATETIME_SUB"));
column.setCharOctetLength(rs.getInt("CHAR_OCTET_LENGTH"));
column.setOrdinalPosition(rs.getInt("ORDINAL_POSITION"));
columns.add(column);
} catch (Exception e) {
Log.getLogger().error("Could not capture table schema");
closeResultSet(rs);
return columns;
}I can't say I've ever seen a case where a column held more data than it was declared as, and would have to file that under "see it to believe it" category.
Even if that somehow were the case, I'd expect the ODBC driver to return what the column is defined as anyway, not the data. The data changes with every row, but I'd expect the table metadata to be consistent, and refer to the table definition.
For grins though, can you provide system.out.println output of the metadata, and also a "describe xxxx" from sqlplus if you can, where xxx is the table name?
ie,
while (rs.next()) {
System.out.println("column name is " + rs.getString("COLUMN_NAME"));
System.out.println("data type is " + rs.getInt("DATA_TYPE"));
..etc..
Greg -
Goldengate expects a column that is not in the unique constraint
I do not know golden gate. I am working with a golden gate engineer who doesn't really know oracle. I am the DBA supporting this. This is the issue we are having. Please bare with me if I have trouble explaining it.
I am pulling from oracle and loading to teradata. I confirmed that the unique index is correct in teradata (don't have access. I asked).
Oracle 10.2.0.5
golden gate: 11.1.1.0.29
error: the name of the schema listed in the error is from teradata. So TERADATA_SCHEMA. represents that.
Key column my_id is missing from update on table TERADATA_SCHEMA.MYTABLE
Missing 1 key columns in update for table TERADATA_SCHEMA.MYTABLEbelow is a create table statement. I have altered table and column names. but the structure is the same.
it does NOT have a primary key. It has a unique key. I am not allowed to add a primary key
UNIQUE INDEX: UNIQUE_ID
When we test an updates, golden gate is expecting MY_ID to be sent as well and golden gate abends
The DDL below includes the partitioning/subpartition, unique index, and supplemental logging command that golden gate runs.
I have also run the following 2 commands to turn on supplemental logging:
ALTER DATABASE ADD SUPPLEMENTAL LOG DATA;
ALTER SYSTEM SWITCH LOGFILE;
CREATE
TABLE MYTABLE
"UNIQUE_ID" NUMBER(10,0) NOT NULL ENABLE,
"MY_ID" NUMBER(10,0),
"MYNUMBER" NUMBER(8,0),
"TOTALNUMBER" NUMBER(8,0),
"USED" NUMBER(8,0),
"LOTSUSED NUMBER(8,0),
"LAST_UPDATE_USER" VARCHAR2(30 BYTE),
"LAST_UPDATE_DATE" DATE,
"MYDATESTAMP" DATE,
"MYTYPE" NUMBER(2,0) NOT NULL ENABLE,
"MYTHING" CHAR(1 BYTE) NOT NULL ENABLE
PARTITION BY RANGE
"MYTYPE"
SUBPARTITION BY LIST
"MYTHING"
SUBPARTITION TEMPLATE
SUBPARTITION "MYTHING_X" VALUES
'X'
SUBPARTITION "MYTHING_Z" VALUES
'Z'
PARTITION "MYTHING1" VALUES LESS THAN (2) ,
PARTITION "MYTHING2" VALUES LESS THAN (3) ,
PARTITION "MYTHING3" VALUES LESS THAN (4) ,
PARTITION "MYTHING4" VALUES LESS THAN (5) ,
PARTITION "MYTHING5" VALUES LESS THAN (6) ,
PARTITION "MYTHING6" VALUES LESS THAN (7) ,
PARTITION "MYTHING7" VALUES LESS THAN (8) ,
PARTITION "MYTHING8" VALUES LESS THAN (9) ,
PARTITION "MYTHING_OTHER" VALUES LESS THAN (MAXVALUE)
ALTER TABLE MYTABLE ADD SUPPLEMENTAL LOG GROUP
"MYGROUP_555"
"UNIQUE_ID"
ALWAYS;
CREATE UNIQUE INDEX MY_IND ON MYTABLE (
"UNIQUE_ID"
;Edited by: Guess2 on Nov 3, 2011 12:57 PM
Edited by: Guess2 on Nov 3, 2011 1:21 PMGoldenGate expects a primary key, a unique key, or a list of key columns.
The addition of supplemental logging for the table can be done via SQL, but typically, it is done via the GGSCI interface:
GGSCI 4> dblogin userid <your DB GoldenGate user>, password <your password?
GGSCI 5> add trandata schema_owner.table_name
How Oracle GoldenGate determines the kind of row identifier to useUnless a KEYCOLS clause is used in the TABLE or MAP statement, Oracle GoldenGate selects a
row identifier to use in the following order of priority:
1. Primary key
2. First unique key alphanumerically with no virtual columns, no UDTs, no function-based
columns, and no nullable columns
3. First unique key alphanumerically with no virtual columns, no UDTs, or no function-based
columns, but can include nullable columns
4. If none of the preceding key types exist (even though there might be other types of keys
defined on the table) Oracle GoldenGate constructs a pseudo key of all columns that
the database allows to be used in a unique key, excluding virtual columns, UDTs,
function-based columns, and any columns that are explicitly excluded from the Oracle
GoldenGate configuration.
NOTE If there are other, non-usable keys on a table or if there are no keys at all on the
table, Oracle GoldenGate logs an appropriate message to the report file.
Constructing a key from all of the columns impedes the performance of Oracle
GoldenGate on the source system. On the target, this key causes Replicat to use
a larger, less efficient WHERE clause.
How to specify your own key for Oracle GoldenGate to use
If a table does not have one of the preceding types of row identifiers, or if you prefer those
identifiers not to be used, you can define a substitute key if the table has columns that
always contain unique values. You define this substitute key by including a KEYCOLS clause
within the Extract TABLE parameter and the Replicat MAP parameter. The specified key will
override any existing primary or unique key that Oracle GoldenGate finds.>
"I have altered table and column names. but the structure is the same."
What column name did you alter?
The source table table and target table are either identical, or there must be a source definition file created on the source and copied over to the target and referenced in the replicat.
I don't see why my_id would cause a problem (based on what you posted), unless the tables are different. -
How to get the name of the column returning from reslut set
for the below code how can i get the table B column names?
Thank you.
stm = con.createStatement();
rs = stm.executeQuery("select a.title, b.* from Tbl_Questions a, Tbl_Answers b where b.id=" + answerId +" and b.questionId=a.id");
if( rs.next() ) {
answer.setId(answerId);
answer.setQuestionId(rs.getString("b.questionId"));
answer.setQuestionTitle(rs.getString("a.title"));
answer.setTitle(rs.getString("b.title"));
answer.setInputType(rs.getString("b.inputtype"));
}Column names may be output with meta data.
DatabaseMetaData metadata = null;
Class.forName("oracle.jdbc.driver.OracleDriver");
String url="jdbc:oracle:thin:@localhost:1521:ORCL";
Connection currentConnection = DriverManager.getConnection(url,
"oe", "");
metadata = currentConnection.getMetaData();
String[] names = {"TABLE"};
ResultSet tables = metadata.getTables(null,"%", "%", names);
while (tables.next()) {
String tableName = tables.getString("TABLE_NAME");
String tableSchema = tables.getString("TABLE_SCHEM");
String tableType = tables.getString("TABLE_TYPE");
System.out.println("Table Name:"+tableName+ " Table Schema: "+tableSchema+ " Table Type: "+tableType);
ResultSet columns = metadata.getColumns(null, "%", tableName, "%");
while (columns.next()) {
String columnName = columns.getString("COLUMN_NAME");
String datatype = columns.getString("TYPE_NAME");
int datasize = columns.getInt("COLUMN_SIZE");
int nullable = columns.getInt("NULLABLE");
System.out.println("Column Name: "+columnName+ " Data Type: "+datatype+ " Data Size: "+datasize+" Nullable: "+nullable);
} -
Need to change the column constrain from NOT NULL to NULL
Hi,
My requriment is I have to change the column constraint (NOT NULL) to NULLable (column having data), I used below query for that
alter table table_name modify transaction_cost2 default null
even command is successfull, but column constrain is still NOT NULL.
can you any one help on this.. ( steps to change column constain from not null to null)
Thanks,ALTER TABLE table_name
MODIFY( transaction_cost2 NUMBER NULL )That assumes that the data type of the TRANSACTION_COST2 column is NUMBER-- you'll want to use the current data type if it is something else. I'm hoping that the fact that you have a column named TRANSACTION_COST2 doesn't imply that you have an incorrectly normalized data model. But the name of the column certainly implies that you do.
Justin -
Will there be nullable primitve type support in actionscript any time soon?
A lot of times there is just a serious need to have a
nullable column in a DB because it is important to denote a not-set
value. Passing in 0 to that field from the code layer because the
programming language just can't natively support a nullable int is
not a good thing. Now, I have to keep track of special values for
each and every column that is nullable but equates to a
non-nullable primitive type in the programming language that passes
column values in. This create a ton of overhead on the programming
side as well as the GUI side (because the GUI classes like a
textbox don't have the concept of an unset value)...
.NET 2.0 fixes this very nicely and I am hoping that
Actionscript 4.0 will, too...
In the mean time is there an elegant and simple way to
program around this?hi mjpettitt, i don't know enough about the particulars of your question to give a definite answer. however firefox is a webbrowser that aims to be standards compliant - it renders html an not any proprietary formats. so the long term "solution" of this problem would probably be for Captivate to generate output that complies with web standards...
Maybe you are looking for
-
ASA 5505 + ASA 5540 static VPN, ssh and rdp problems
Greetings! I've recentely set up a VPN between Cisco ASA 5540(8.4) ana 5505(8.3). Everything works fine, but there is a small problem that is really annoying me. From the inside network behind ASA 5505 I connect via rdp or ssh to a host inside ASA 55
-
How do i stop contact synching between two iPhones?
how do i stop contact synching between two iPhones?
-
I can't access the Mozilla webpage on my computer since a friend of mine made some changes. The Google page used take up half the page when I opened Mozilla but now it takes 7/8th of the page so much so I can not access "my book marks"; file, view an
-
I am having a problem using rsh between a Solaris 8 box and a Solaris 9 box. I can rsh from 8 to 9 and enter password etc.. and get logged in. ie: rsh remotehost passwd I'm in. The problem is I just want to pass a command (like who) from 8 to 9. ie:
-
An unknown error has occurred (-3256)
i use to be able to play itunes through my computer speaker and airport express (stereo speakers) at the same time. now i keep getting a error accurred connecting to remote speakers "living room".. an unknown error has accurred (-3256). i can only us