ddl

Oracle: DDL and transaction rollback

人盡茶涼 提交于 2019-11-27 08:53:08
Could in Oracle DDL (create/alter) be transactional like they are in MS SQL (started from 2005)? GolezTrol No. In Oracle DDL statements themselves are not transactional. Running a DDL statement will implicitly commit any open transaction for that session before starting the actual work. In addition some statements, like an alter table statement, may fail if another session has an open transaction on the object being modified or one of its dependencies. You can set a ddl_lock_timeout to specify how long you want Oracle to wait for the object to become available. See DDL Statements for a summary

To prevent the use of duplicate Tags in a database

泄露秘密 提交于 2019-11-27 08:48:42
问题 I would like to know how you can prevent to use of two same tags in a database table. One said me that use two private keys in a table. However, W3Schools -website says that it is impossible. My relational table alt text http://files.getdropbox.com/u/175564/db/db7.png My logical table alt text http://files.getdropbox.com/u/175564/db/db77.png The context of tables alt text http://files.getdropbox.com/u/175564/db/db777.png How can you prevent the use of duplicate tags in a question? 回答1: I have

Create table in Procedure

被刻印的时光 ゝ 提交于 2019-11-27 08:27:16
问题 I have created the table "Risiko" which shouldntbe dynamic, i tought it would be that simple but it was not. How should i solve it? and what am i doing wrong? CREATE OR REPLACE PROCEDURE TABLERISIKO IS BEGIN drop table risiko; CREATE TABLE Risiko ( RNr INTEGER, Projekt INTEGER, Text VARCHAR(25), Gruppe INTEGER, Auswirkung INTEGER, WKeit INTEGER, Pruefdatum DATE, PRIMARY KEY (RNr), CONSTRAINT FKRisiko1 FOREIGN KEY (Projekt) REFERENCES Projekt(ProNr), CONSTRAINT FKRisiko2 FOREIGN KEY (Gruppe)

SQL中有关DQL、DML、DDL、DCL的概念与区别?

大憨熊 提交于 2019-11-27 08:17:26
SQL(Structure Query Language)结构化查询语言是数据库的核心语言,是高级的非过程化编程语言。它功能强大,效率高,简单易学易维护。SQL语言基本上独立于数据库本身、使用的机器、网络、操作系统,基于SQL的DBMS产品可以运行在从个人机、工作站到基于局域网、小型机和大型机的各种计算机系统上,具有良好的可移植性。 SQL结构化查询语言包含6个部分 1.数据查询语言(DQL: Data Query Language) 数据检索语句,用于从表中获取数据。通常最常用的为保留字SELECT,并且常与FROM子句、WHERE子句组成查询SQL查询语句。 语法: SELECT <字段名> FROM <表或视图名> WHERE <查询条件>; 2.数据操纵语言(DML:Data Manipulation Language) 主要用来对数据库的数据进行一些操作,常用的就是INSERT、UPDATE、DELETE。 语法: INSERT INTO <表名>(列1,列2,...) VALUES (值1,值2,...); UPDATE <表名> SET <列名>=新值 WHERE <列名>=某值; DELETE FROM <表名> WHERE <列名>=某值; 3.事务处理语言(DPL) 事务处理语句能确保被DML语句影响的表的所有行及时得以更新。TPL语句包括BEGIN

浅谈 DML、DDL、DCL的区别

拈花ヽ惹草 提交于 2019-11-27 07:44:06
一、DML DML(data manipulation language)数据操纵语言:     就是我们最经常用到的 SELECT、UPDATE、INSERT、DELETE。 主要用来对数据库的数据进行一些操作。 SELECT 列名称 FROM 表名称 UPDATE 表名称 SET 列名称 = 新值 WHERE 列名称 = 某值 INSERT INTO table_name (列1, 列2,...) VALUES (值1, 值2,....) DELETE FROM 表名称 WHERE 列名称 = 值 二、DDL DDL(data definition language)数据库定义语言:     其实就是我们在创建表的时候用到的一些sql,比如说:CREATE、ALTER、DROP等。DDL主要是用在定义或改变表的结构,数据类型,表之间的链接和约束等初始化工作上 CREATE TABLE 表名称 ( 列名称1 数据类型, 列名称2 数据类型, 列名称3 数据类型, .... ) ALTER TABLE table_name ALTER COLUMN column_name datatype DROP TABLE 表名称 DROP DATABASE 数据库名称 三、DCL DCL(Data Control Language)数据库控制语言:    

Force Oracle Drop Global Temp Table

☆樱花仙子☆ 提交于 2019-11-27 06:11:31
问题 In our project I create some global temp table that will be like these: CREATE GLOBAL TEMPORARY TABLE v2dtemp ( id NUMBER, GOOD_TYPE_GROUP VARCHAR2(250 BYTE), GOOD_CODE VARCHAR2(50 BYTE), GOOD_TITLE VARCHAR2(250 BYTE) ) ON COMMIT PRESERVE ROWS; but the problem comes when I want to drop this table. Oracle will not let me to drop the table, and it says: ORA-14452: attempt to create, alter or drop an index on temporary table already in use I have to use this table in some procedure but it may be

ALTER TABLE without locking the table?

一世执手 提交于 2019-11-27 05:56:45
When doing an ALTER TABLE statement in MySQL, the whole table is read-locked for the duration of the statement. If it's a big table, that means insert or update statements could be locked for a looooong time. Is there a way to do a "hot alter", like adding a column in such a way that the table is still updatable throughout the process? Mostly I'm interested in a solution for MySQL but I'd be interested in other RDBMS if MySQL can't do it. To clarify, my purpose is simply to avoid downtime when a new feature that requires an extra table column is pushed to production. Any database schema will

Truncating a table in a stored procedure

前提是你 提交于 2019-11-27 05:27:25
问题 When I run the following in an Oracle shell it works fine truncate table table_name But when I try to put it in a stored procedure CREATE OR REPLACE PROCEDURE test IS BEGIN truncate table table_name; END test; / it fails with ERROR line 3, col 14, ending_line 3, ending_col 18, Found 'table', Expecting: @ ROW or ( or . or ; := Why? 回答1: All DDL statements in Oracle PL/SQL should use Execute Immediate before the statement. Hence you should use: execute immediate 'truncate table schema.tablename

SQL DML 和 DDL

为君一笑 提交于 2019-11-27 04:46:23
可以把 SQL 分为两个部分:数据操作语言 (DML) 和 数据定义语言 (DDL)。 SQL (结构化查询语言)是用于执行查询的语法。但是 SQL 语言也包含用于更新、插入和删除记录的语法。 查询和更新指令构成了 SQL 的 DML 部分: SELECT - 从数据库表中获取数据 UPDATE - 更新数据库表中的数据 DELETE - 从数据库表中删除数据 INSERT INTO - 向数据库表中插入数据 SQL 的数据定义语言 (DDL) 部分使我们有能力创建或删除表格。我们也可以定义索引(键),规定表之间的链接,以及施加表间的约束。 SQL 中最重要的 DDL 语句: CREATE DATABASE - 创建新数据库 ALTER DATABASE - 修改数据库 CREATE TABLE - 创建新表 ALTER TABLE - 变更(改变)数据库表 DROP TABLE - 删除表 CREATE INDEX - 创建索引(搜索键) DROP INDEX - 删除索引 转载于:https://www.cnblogs.com/order/archive/2013/03/08/2949307.html 来源: https://blog.csdn.net/weixin_30222723/article/details/99407693

How do I get column datatype in Oracle with PL-SQL with low privileges?

旧城冷巷雨未停 提交于 2019-11-27 04:15:41
问题 I have "read only" access to a few tables in an Oracle database. I need to get schema information on some of the columns. I'd like to use something analogous to MS SQL's sp_help . I see the table I'm interested in listed in this query: SELECT * FROM ALL_TABLES When I run this query, Oracle tells me "table not found in schema", and yes the parameters are correct. SELECT DBMS_METADATA.GET_DDL('TABLE', 'ITEM_COMMIT_AGG', 'INTAMPS') AS DDL FROM DUAL; After using my Oracle universal translator