Академический Документы
Профессиональный Документы
Культура Документы
General form:
database.schema.object @server
General form:
server.database.schema. object
Datatypes
Oracle Microsoft SQL Server
CHAR VARCHAR2,
NVARCHAR2 NUMBER
CHAR VARCHAR,
NVARCHAR TINYINT, SMALLINT, INT, BIGINT, NUMERIC
DATETIME,
SMALLDATETIME UNIQUEIDENTIFIER and NEWID()
Datatypes (2)
Oracle Microsoft SQL Server
BFILE stores
images on a file on the file system BLOB stores images within the database
Boolean Datatype
Oracle
declare v1 boolean := true; v2 boolean := false; begin v1 := (x>3) and v2; end;
Tables
Oracle Microsoft SQL Server
Up to 1000 columns
per table Unlimited row size
Up to 1024 columns
per table Up to 8,060 bytes including 16 bytes to point to each text or image column Create table with SELECT INTO statement:
Indexes
Oracle Microsoft SQL Server
Indexes on functions
Unlimited table
indexes Up to 32 columns per index
Variables
Oracle Microsoft SQL Server
Doesnt require a
special prefix: declare var1 varchar2(30);
Variable names
prefixed by @: declare @var1 varchar;
Assignment:
var1 := test;
Assignment:
SET @var1 = test or SELECT @var1 = test
IF Statement
Oracle
declare v1 numeric; begin v1 := 1; if v1 > 1 then dbms_output.put_line (1>1); v1 := 100; elseif v1 > 2 then dbms_output.put_line (1 > 2); v1 := 200; else dbms_output.put_line (None); null; end if;
end;
LOOP Statement
Oracle Microsoft SQL Server
loop exit when rank > max_rank; do something; rank := rank + 1; end loop;
while (1 =1) begin if @rank > @max_rank break do something set @rank = @rank +1 end
WHILE Statement
Oracle Microsoft SQL Server
while rank <= max_rank loop do something; rank := rank + 1; end loop;
while (@rank <= @max_rank) begin do something set @rank = @rank +1 end
declare @rank int set @rank = 1 while (@rank <= max_rank) begin do something set @rank = @rank +1 end
Cursor Attributes
Oracle Microsoft SQL Server
cursor_name%NOTF
OUND cursor_name%FOUN D cursor_name%ISOP EN
(@@FETCH_STATU
S = -1) (@@FETCH_STATU S = 0) (cursor_status (local, cursor_name) = 1) @v_cursor_name_ro wcount declared and incremented after each fetch operation
cursor_name%ROW
COUNT