Recent Notes
Displaying keyword search results 1 - 10
Created by Dr. Xi on February 06, 2012 12:14:11
Last update: February 07, 2012 15:39:35
Oracle sqlplus command line tools does not support command line editing out-of-the-box. But on Linux there's a handy utility that enables command line editing with any command line tool: rlwrap - readline wrapper.
Install rlwrap:
$ sudo apt-get install rlwrap
Create a keywords file .sql.dict (optional, but convenient):
false null true
access add as asc begin by chec...
It would be nice to add the tables names also.
Create an alias for sqlplus (put it in .bashrc ):
alias sqlplus='rlwrap -f $HOME/.sql.dict sqlplus'
Created by James on March 27, 2009 03:20:58
Last update: May 08, 2011 12:32:31
Use show create table <tablename> :
mysql> show create table my_test_table;
+------...
Select from information_schema.table_constraints and information_schema.key_column_usage
mysql> select * from information_schema.table_cons...
Created by Dr. Xi on March 05, 2011 14:39:42
Last update: March 05, 2011 14:40:35
Select from information_schema :
mysql> select cc.character_set_name
-> from...
Other columns available from the information_schema tables:
mysql> desc tables;
+-----------------+--------...
Note that show create table <table_name> also works.
Created by Dr. Xi on March 05, 2011 14:31:44
Last update: March 05, 2011 14:32:21
Select from information_schema.tables :
mysql> select table_collation from information_sch...
Or,
show create table mysql.host;
CREATE TABLE `host` (
`Host` char(60) collate...
Created by Fang on August 16, 2010 21:44:41
Last update: August 16, 2010 22:01:46
The tags <sql:query> Queries a database. Syntax:
<sql:query sql="sqlQuery" var="varName" [scope... or, put the query within the element body: <sql:query var="varName" [scope="{page|req... Attributes: Name Dynamic? Type Description sql true String SQL query statement. dataSource true javax.sql.DataSource or String Data source associated with the database to query. A String value represents a relative path to a JNDI resource or the JDBC parameters for the DriverManager class. maxRows true int The maximum number of rows to be included in the query result. If not specified, or set to -1, no limit on the maximum number of rows is enforced. startRow true int The returned Result object includes the rows starting at the specified index. The first row of the original query result set is at index...
Created by voodoo on July 12, 2010 18:44:06
Last update: July 12, 2010 18:44:06
Use the \d command to show information about a table:
postgres=# \d patchtype
Table ...
Created by Dr. Xi on January 07, 2010 23:40:28
Last update: February 09, 2010 03:24:35
This is a utility to generate SQL insert statements for Oracle for one table, or a set of tables. It doesn't cover all possibilities but should be good enough for most cases.
import java.io.*;
import java.sql.*;
import ...
To generate insert statements for multiple tables, simply put the table names in a file, one per line, and use the -f switch.
Created by Dr. Xi on April 26, 2007 02:37:58
Last update: December 24, 2009 21:50:12
The AFTER clause must be last. There's no BEFORE clause.
ALTER TABLE table_name
ADD COLUMN column_name ...
Created by Dr. Xi on October 09, 2009 19:27:22
Last update: October 09, 2009 19:30:01
PL/SQL code from Pandazen :
CREATE OR REPLACE FUNCTION GET_INSERT_SCRIPT(V_TAB...
Usage:
To create the script for generating the INSERT statements:
set head off
set pages 0
set trims on
set...
Run the resulting script to generate the INSERT script:
set pages 0
set trims on
set lines 2000
...
PL/SQL code from Oracle Ask Tom
set serveroutput on size 100000
set feedbac...
Created by Dr. Xi on July 15, 2009 22:34:23
Last update: July 15, 2009 22:34:23
To add one column:
alter table address add country_code char(3) not n...
To add multiple columns:
alter table table_name add
(
column1 dat...