DtSQL - Cache Features

 

 
 

 

 
 

Table

Create Table

Cache allows to create a new table. After entering the table name and column information, DtSQL can generate and execute the SQL to create the table.

  • Column Name
  • Column Type
  • Length/Precesion
  • Scale (decimal)
  • Default Value
  • Nullable
  • Primary Key
  • Unique

Sample :
CREATE TABLE "SAMPLE"."TEST_TABLE" (
a bigint NOT NULL DEFAULT 1,
b char ( 12 ) NOT NULL DEFAULT 'abc',
c numeric ( 12, 2 ) ,

PRIMARY KEY ( a, b ),
UNIQUE ( b,c )
)

Truncate Table

Cache does not allows to truncate an table and deleting table is used instead. After entering the table name, DtSQL can delete all data in the table.

Sample : DELETE FROM "SAMPLE"."TEST_TABLE"

Drop Table

Cache allows to drop an existing table. After entering the table name, DtSQL can generate and execute the SQL to drop the table.

Sample : DROP TABLE "SAMPLE"."TEST_TABLE"

TOP
 

Column

Add Column

Cache allows to add a new column to an existing table. After selecting the table and entering column information, DtSQL can generate and execute the SQL to add the new column to the table.

  • Column Name
  • Column Type
  • Length/Precesion
  • Scale (decimal)
  • Default Value
  • Nullable

Sample :
ALTER TABLE
"SAMPLE"."TEST_TABLE"
ADD
d varchar(20) NOT NULL DEFAULT 'def'

Change Data Type

Cache allows to change the column data. After selecting the new data type, DtSQL can generate and execute the SQL to change the column data type.

Sample :
ALTER TABLE "TEST_SCHEMA"."TEST_TABLE"
ALTER COLUMN F BIGINT

Drop Column

Cache allows to delete an existing column. After selecting the column, DtSQL can generate and execute the SQL to delete the column.

Sample :
ALTER TABLE "SAMPLE"."TEST_TABLE"
DROP COLUMN F RESTRICT

TOP
 

View

Create View

Cache allows to create a new view. After entering the view name and select SQL, DtSQL can generate and execute the SQL to create the view.

Sample :
CREATE VIEW "SAMPLE"."TEST_VIEW"
AS
SELECT * FROM "SAMPLE"."TEST_TABLE"

Drop View

Cache allows to drop an existing view. After selecting the view name, DtSQL can generate and execute the SQL to delete the view.

Sample : DROP VIEW "SAMPLE"."TEST_VIEW"

TOP
 

Index

Create Index

Cache allows to create a new index. After selecting the table columns and entering the view name, DtSQL can generate and execute the SQL to create the index.

Sample :
CREATE UNIQUE INDEX "SAMPLE"."TEST_INDEX"
ON SAMPLE.TEST_TABLE ( A, B DESC, C DESC )

Drop Index

Cache allows to drop an existing index. After selecting the index name, DtSQL can generate and execute the SQL to delete the index.

Sample : DROP INDEX "SAMPLE"."TEST_INDEX" ON "SAMPLE"."TEST_TABLE"

TOP
 

Constraint

Create Primary Key

Cache allows to create a primary key for a table. After selecting the table columns, DtSQL can generate and execute the SQL to create the primary key.

Sample :
ALTER TABLE
"TEST_SCHEMA"."TEST_TABLE"
ADD
PRIMARY KEY ( B, C )

Create Foreign Key

Cache allows to create a foreign key for a table to reference to another table. After selecting the table columns and referenced table columns, DtSQL can generate and execute the SQL to create the foreign key.

Sample :
ALTER TABLE
"TEST_SCHEMA"."TEST_TABLE"
ADD
FOREIGN KEY ( A, C )
REFERENCES "TEST_SCHEMA"."TEST_TB" (B, A )

Create Check Constraint

Cache allows to create a check constraint for a table column. After entering the check constraint name and check action, DtSQL can generate and execute the SQL to create the check constraint.

Sample :
ALTER TABLE
"TEST_SCHEMA"."TEST_TABLE"
ADD CONSTRAINT "TEST_CHECK"
CHECK ( C > 10 )

Create Unique Constraint

Cache allows to create an unique constraint for a table columns. After entering the unique constraint name and selecting table columns, DtSQL can generate and execute the SQL to create the unique constraint.

Sample :
ALTER TABLE
"TEST_SCHEMA"."TEST_TABLE"
ADD CONSTRAINT "TEST_UNIQUE"
UNIQUE ( B, C )

Drop Primary Key

Cache allows to drop an existing primary key. After selecting the primary key, DtSQL can generate and execute the SQL to delete the primary key.

Sample : ALTER TABLE "TEST_SCHEMA"."TEST_TABLE" DROP PRIMARY KEY

 

TOP
 

Procedure

Create Procedure

Cache allows to create procedures. After entering the procedure name, parameter names and procedure body, DtSQL can generate and execute the SQL to create the procedure.

Sample :
CREATE PROCEDURE "TEST_SCHEMA"."TEST_PROC"
( IN PARAM1 BIGINT, INOUT PARAM2 VARCHAR(20), OUT parm3 TIMESTAMP)
BEGIN
UPDATE "Sample"."Employee" SET Salary = :PARAM1 + 100 ;
END

Drop Procedure

Cache allows to drop an existing procedure. After selecting the procedure, DtSQL can generate and execute the SQL to delete the procedure.

Sample : DROP PROCEDURE "TEST_SCHEMA"."TEST_PROC"

TOP
 

Function

Create Function

Cache allows to create functions. After entering the procedure name, parameter names and function body, DtSQL can generate and execute the SQL to create the function.

Sample :
CREATE FUNCTION "TEST_SCHEMA"."TEST_FUNC"
( PARAM1 VARCHAR(20), PARAM2 BIGINT, PARAM3 DATE )
RETURNS BIGINT
LANGUAGE OBJECTSCRIPT
{
NEW %ROWCOUNT

&sql ( SELECT * FROM "Sample"."Person" )
QUIT %ROWCOUNT
}

Drop Function

Cache allows to drop an existing function. After selecting the function, DtSQL can generate and execute the SQL to delete the function.

Sample : DROP FUNCTION "TEST_SCHEMA"."TEST_FUNC"

TOP

Copyright DigerTech Inc