oracle資料庫資料修改語句,Oracle資料庫資料修改語句

時間 2021-10-14 22:16:40

1樓:墨汁諾

把查出來的資料做乙個表g,a.rsc_status_cd as rsc_status

使用update g set g.rsc_status = '43'。

使用b表資料更新a表,那麼where條件是什麼,也就是說,更新a表中哪些資料,用b表中的哪些資料更新,二者的關係是什麼。從你的語句中我看不出b表和a表的關聯。

找到關聯條件後,通過關聯條件查出的b表資料是否唯一,如果不唯一,還是會出現「返回值多於一行」的錯誤。

邏輯結構

它由至少乙個表空間和資料庫模式物件組成。這裡,模式是物件的集合,而模式物件是直接引用資料庫資料的邏輯結構。模式物件包括這樣一些結構:

表、檢視、序列、儲存過程、同義詞、索引、簇和資料庫鏈等。邏輯儲存結構包括表空間、段和範圍,用於描述怎樣使用資料庫的物理空間。

總之,邏輯結構由邏輯儲存結構(表空間,段,範圍,塊)和邏輯資料結構(表、檢視、序列、儲存過程、同義詞、索引、簇和資料庫鏈等)組成,而其中的模式物件(邏輯資料結構)和關係形成了資料庫的關係設計。

2樓:

表 rm.phone_number@gzcrm 有沒有主鍵?

有,如下

update rm.phone_number@gzcrmset rsc_status_cd=43

where a.主鍵 in (

select a.主鍵 from rm.phone_number@gzcrm a,rm.

access_number_type@gzcrm b,rm.resource_status@gzcrm c,rm.phone_number_pool@gzcrm d

where a.an_type_cd=b.an_type_cdand a.rsc_status_cd=c.rsc_status_cd

and a.pool_id=d.pool_idand a.area_id='8'

and a.an_type_cd='101'

and (a.phone_number like '%000'

or a.phone_number like '%111'

or a.phone_number like '%222'

or a.phone_number like '%333'

or a.phone_number like '%444'

or a.phone_number like '%555'

or a.phone_number like '%666'

or a.phone_number like '%777'

or a.phone_number like '%888'

or a.phone_number like '%999'

)and a.rsc_status_cd in ('1')))

3樓:匿名使用者

select a.phone_number,b.name,c.name,a.version,d.name,a.rsc_status_cd

from rm.phone_number@gzcrm a,rm.access_number_type@gzcrm b,rm.

resource_status@gzcrm c,rm.phone_number_pool@gzcrm d

where a.an_type_cd=b.an_type_cdand a.rsc_status_cd='43'

and a.rsc_status_cd=c.rsc_status_cd

and a.pool_id=d.pool_idand a.area_id='8'

and a.an_type_cd='101'

and (a.phone_number like '%000'

or a.phone_number like '%111'

or a.phone_number like '%222'

or a.phone_number like '%333'

or a.phone_number like '%444'

or a.phone_number like '%555'

or a.phone_number like '%666'

or a.phone_number like '%777'

or a.phone_number like '%888'

or a.phone_number like '%999'

)and a.rsc_status_cd in ('1'));

4樓:

1樓括號沒對應上了,估計你的沒對應他直接複製過去了,你調整下應該ok了,那個主鍵要你自己對應改下

oracle資料庫如何修改欄位的資料型別?

5樓:匿名使用者

用alter語句進行修改。

語法:alter table 表名 modify 欄位名 字段型別(字段長度);

說明:如果是內date等沒有長度的型別,字容段長度部分可以省略。

如:目前test表屬性如下

要將name列的字段型別改為date型別,可用如下語句:

alter table test modify name date;

此時可見name列的型別已經更新成功。

注意事項:

如果表中有資料盡量不要使用此語句,會造成資料丟失,應在備份的情況下進行修改。

6樓:匿名使用者

建議新加字段,再用sql語句拷貝資料過來,新應用直接使用新字段。

7樓:誦葬花

用工具把所有資料匯出來,改完 再 導進來不就可以了,如果資料格式不對 就在記事本裡批量修改一下

oracle資料庫update語句?

oracle資料庫刪除表中一條資料sql語句

8樓:超級大大餅乾

保留表,只刪除資料:

truncate table mytable;

或者:delete from mytable where 1 = 1 ;

commit;

刪除表本身:

drop table mytable;

結構化查詢語言是高階的非過程化程式語言,允許使用者在高層資料結構上工作。它不要求使用者指定對資料的存放方法,也不需要使用者了解具體的資料存放方式,所以具有完全不同底層結構的不同資料庫系統, 可以使用相同的結構化查詢語言作為資料輸入與管理的介面。結構化查詢語言語句可以巢狀,這使它具有極大的靈活性和強大的功能。

2023年10月,美國國家標準協會對sql進行規範後,以此作為關係式資料庫管理系統的標準語言(ansi x3. 135-1986),2023年得到國際標準組織的支援下成為國際標準。不過各種通行的資料庫系統在其實踐過程中都對sql規範作了某些編改和擴充。

所以,實際上不同資料庫系統之間的sql不能完全相互通用。

oracle資料庫如何用update批量更新某列資料中的字段

9樓:穆亞楓

update的語法格式為:

update 表名

set 欄位名=「更新的值」

[where 欄位名 = 限制條件值] --這部分可以不加,如果是更新整個表。

10樓:匿名使用者

跟sql server類似。bai

可以使用

du程式設計,

zhi或者使用pl/sql連線oracle資料庫,登陸連線後,使dao用以下sql:

update table set id='tt' where a='xx';

以上語句,就內是將表table中列a='xx'的所有容id列改為「tt」。

條件可以新增多個,更新的字段也可以新增多個,比如:

update table set id1='tt',id2='cc' where a='xx' and b='yy' ;

11樓:匿名使用者

update tal set name=replace(name,'廣東省','湖南省') where name like '廣東省%'

12樓:

update tal set name = '湖南' || substr(name,3,len(name) - 2) where substr(name,1,2) = '廣東'

oracle資料庫備份語句

exp 畢竟也需要連線到資料庫,也就是需要提供使用者名稱,密碼,所以你說的資料庫模式匯出,是無法正常實現的。但是使用dba使用者登陸,可以實現匯出整個資料庫的類似功能。資料庫模式 exp system passwd oracle full y file db081222.dmp log db0812...

oracle資料庫,oracle資料庫價格

oracle是一種適用於大型 中型和微型計算機的關聯式資料庫管理系統,它使用sql structured guery language 作為它的資料庫語言。sql主要包括資料定義 資料操縱 包括查詢 和資料控制等三方面功能。sql是一種非過程化程度很高的語言,使用者只需說明 幹什麼 而無需具體說明 怎麼...

Oracle資料庫課程,用SQL語句

create table student id number 10 name varchar2 20 not null,age number 2 not null,primary key id insert into student id,name,age values 1,張三 20 commit...