ddl

Oracle: DBMS_UTILITY.EXEC_DDL_STATEMENT vs EXECUTE IMMEDIATE

你离开我真会死。 提交于 2019-12-03 11:53:00
问题 Which are the differences between DBMS_UTILITY.EXEC_DDL_STATEMENT and EXECUTE IMMEDIATE ? 回答1: Fundamentally they do the same thing, which is to provide a mechanism to execute DDL statements in PL/SQL, which isn't supported natively. If memory serves me well, the EXEC_DDL_STATEMENT was available in the Oracle 7 version of the DBMS_UTILITY package, whereas Native Dynamic SQL (EXECUTE IMMEDIATE) was only introduced in 8. There are a couple of differences. EXECUTE IMMEDIATE is mainly about

Adding comment to column when I create table in PostgreSQL?

我的梦境 提交于 2019-12-03 10:24:42
问题 How can I add comment to column in PostgreSQL? create table session_log ( UserId int index not null, PhoneNumber int index); 回答1: Comments are attached to a column using the comment statement: create table session_log ( userid int not null, phonenumber int ); comment on column session_log.userid is 'The user ID'; comment on column session_log.phonenumber is 'The phone number including the area code'; You can also add a comment to the table: comment on table session_log is 'Our session logs';

Generate table DDL via query on MySQL and SQL Server

十年热恋 提交于 2019-12-03 09:28:15
Is there an easy way to extract table DDL information, via a query, using either Ms or My SQL server? (preferably both?) For example, using MySQL Administrator / Navicat for MySql, there is a "DDL" function, which generates the "create table foo (....)" script. Is there any way to get this information from a query itself, such as: Select DDL from foo where table_name='bar'; Any have the "Create table bar (.....)" returned to me? If not - any suggestions? it's mysql-specific, but SHOW CREATE TABLE gives you the DDL for a table. Squirrel You have to create that yourself. You can query

Create Postgres database using batch file with [template],[encoding],[owner] and a .sql file

情到浓时终转凉″ 提交于 2019-12-03 09:23:26
I want to create a Postgres database using a batch file. Now the normal way of doing this is the following: "C:\Program Files\PostgreSQL\9.0\bin\createdb.exe" -U Myadmin MydatAbseName This script above creates a database with the default database parameters. However, I want to create a database with the following parameters, as follows: WITH OWNER = Myadmin TEMPLATE = template0 ENCODING = 'SQL_ASCII' TABLESPACE = pg_default LC_COLLATE = 'C' LC_CTYPE = 'C' CONNECTION LIMIT = -1; Please tell me how to create a database with the above parameters using Batch files. Also let me know how to use a

Idempotent PostgreSQL DDL scripts

匿名 (未验证) 提交于 2019-12-03 08:52:47
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm looking for a way to script postgreSQL schema changes in an idempotent manner. In MSSQL I could do something like this: if(not exists(select * from information_schema.columns where table_name = 'x' and column_name = 'y')) begin alter table x add y int end go PostgreSQL doesn't seem to allow ad-hoc pl/pgsql in the same way MSSQL does with T-SQL so I can't use control structures in a SQL script and run it with psql -f x.sql. I know PostgreSQL will throw an error if the object already exists but I don't want to have to ignore errors. I

Hibernate JPA to DDL command line tools

匿名 (未验证) 提交于 2019-12-03 08:48:34
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: There are Hibernate tools for mapping files to ddl generation; ddl to mapping files and so on, but I can't find any command line tools for simple DDL generation from JPA annotated classes. Does anyone know an easy way to do this? (Not using Ant or Maven workarounds) 回答1: I'm not sure, whether this is considered a workaround, because you already referred to it in your question. You can use Hibernate Tools to generate DDL from JPA annotated classes. You just need hibernate tools and its dependencies on the classpath and should be fine with

What is a good Visio Enterprise Architect replacement? [closed]

梦想与她 提交于 2019-12-03 06:53:09
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . I've been using Visio 2002/2003 Enterprise Architect to do my database schema design visually and then forward-generate the DDL to create the database. I wanted to switch to Visio 2007, but while it does have database diagramming support, it doesn't have the ability to generate DDL. Bummer. I am really

Hive 教程(三)-DDL基础

こ雲淡風輕ζ 提交于 2019-12-03 06:31:41
DDL,Hive Data Definition Language,数据定义语言;就是数据库那一套,本文总结一下基本方法 管理表 vs 外建表 管理表也称内建表;hive 默认创建的表都是管理表; 管理表和外建表的数据都存储在 hdfs,因为都是 hive 的表; 区别 hive 在创建内部表时,会把数据移动到数据仓库指定的路径,如 hdfs 某个地方; 如果创建外部表,不会移动数据,仅在元数据中记录数据所在的位置; 最大的区别在于 :当删除内部表时,同时删除数据和元数据;当删除外部表时,仅删除元数据,不删除数据; 鉴于这种特性,管理表不适合共享数据,容易产生安全问题; 在实际工作中,一般使用外建表 Database Create Database CREATE (DATABASE|SCHEMA) [IF NOT EXISTS] database_name [COMMENT database_comment] [LOCATION hdfs_path] [WITH DBPROPERTIES (property_name=property_value, ...)]; 示例 hive> create database hive1101 location '/usr/hive_test'; OK Time taken: 0.12 seconds 注意这里 location 的地址并不是

JPA / EclipseLink - create script source with one SQL statement taking multiple lines

半世苍凉 提交于 2019-12-03 06:17:19
I want to let the persistence provider (EclipseLink 2.5.0) automatically create the tables in the, already existing, database by using the persistence unit property "javax.persistence.schema-generation.create-script-source" and a valid SQL-DDL-script. persistence.xml: <property name="javax.persistence.schema-generation.create-script-source" value="data/ddl.sql"/> ddl.sql: USE myDatabase; CREATE TABLE MyTable ( id INTEGER NOT NULL AUTO_INCREMENT, myColumn VARCHAR(255) NOT NULL, PRIMARY KEY (id) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8 DEFAULT COLLATE = utf8_bin; But I got the following

How can I avoid getting this MySQL error Incorrect column specifier for column COLUMN NAME?

断了今生、忘了曾经 提交于 2019-12-03 05:23:10
How can I avoid getting this MySQL error Incorrect column specifier for column topic_id ? MySQL Error... #1063 - Incorrect column specifier for column 'topic_id' SQL Schema... CREATE TABLE discussion_topics ( topic_id char(36) NOT NULL AUTO_INCREMENT, project_id char(36) NOT NULL, topic_subject VARCHAR(255) NOT NULL, topic_content TEXT default NULL, date_created DATETIME NOT NULL, date_last_post DATETIME NOT NULL, created_by_user_id char(36) NOT NULL, last_post_user_id char(36) NOT NULL, posts_count char(36) default NULL, PRIMARY KEY (topic_id) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO