开发者

How to update single table in oracle?

I am new to oracle. I have created one table in oracle i want to upda开发者_开发问答te that tables with all columns without any content..I want all columns in that table.How to do this?Can anyone explain me?

Regards,

Raman


DESC tablename ? I don't understand what you want... (update the table without any content ?)


describe your_table_name;

should print the table scheme like this :

Name                                        Null?    Type
 ------------------------------------------- -------- -------------

 EMPLOYEE_ID                                 NOT NULL NUMBER(6)
 SALARY                                       NUMBER(8,2)
 HIRE_DATE                                   NOT NULL DATE
 TERMINATION_DATE                             DATE
 TERMINATION_DESC                             VARCHAR2(4000)

you can see some example there.


I think you mean that you want to insert entire rows from one table (call it T1) into another table (call it T2) where there is a NULL anywhere in the row. Is that right?

INSERT INTO t2
SELECT *
FROM   t1
WHERE  t1.col1 IS NULL
OR     t1.col2 IS NULL
OR     t1.col3 IS NULL

... etc.... unfortunately, you need to name all the columns in t1 by hand for this to work. There's no shortcut way to say "WHERE anything IN t2 IS NULL". The closest you could do would be to use a query to help write your query:

SELECT 'OR t1.' || column_name || ' IS NULL' || chr(10)
FROM   all_tab_columns
WHERE  owner = 'DATA_TABLE_OWNER'
AND    table_name = 'T1';
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜