java怎么插入oracle数据库timenstamp,Sybase数据库技术,数据库恢复专家
在oracle的sqlplus中有一個命令:desc,能夠簡要的顯示基表、視圖等的結構。desc的顯示結果簡單明了,比較實用。雖然在Sybase ASE中的存儲過程sp_help也能實現查看表結構的目的;但是,顯示結果很多尤其換行混亂,讓人看得眼花繚亂。顯示的存儲過程:sp_desc能夠實現oracle的sqlplus中desc相同的功能,僅僅多了一列:列序號。
效果圖如下:
存儲過程sp_desc的語法如下:
------=================================================================================
use sybsystemprocs
go
if exists(select 1 from sybsystemprocs.dbo.sysobjects where type="P" and name="sp_desc")
drop proc sp_desc
go
create procedure sp_desc
@tablename varchar(128)
as
declare @table_id int
declare @char_bin_types?? varchar(30)
set nocount on
begin
select @char_bin_types = char(47)+char(39)+char(45)+char(37)+char(35)+char(34)
select @table_id = object_id(@tablename)
select
"序號"=convert(varchar(3),colid),
"列名"=convert(varchar(30),column_name),
"是否為空?"=convert(varchar(7),nullable),
"類型"=convert(varchar(30),
(case scale
when NULL then
case
when charindex(type_name,",ubigint,tinyint,usmallint,uintn,floatn,smallmoneyn,daten,timen,real,bit,sysname,text,image,smalldatetime,real,longsysname,timestamp,datetimn") > 0 then type_name
else
type_name+"("+convert(varchar,precision)+")"
end
when 0 then
case
when charindex(type_name,",ubigint,tinyint,usmallint,uintn,floatn,smallmoneyn,daten,timen,real,bit,sysname,text,image,smalldatetime,real,longsysname,timestamp,datetimn") > 0 then type_name
else
type_name+"("+convert(varchar,precision)+","+convert(varchar,scale)+")"
end
else
case
when charindex(type_name,",ubigint,tinyint,usmallint,uintn,floatn,smallmoneyn,daten,timen,real,bit,sysname,text,image,smalldatetime,real,longsysname,timestamp,datetimn") > 0 then type_name
else
type_name+"("+convert(varchar,precision)+","+convert(varchar,scale)+")"
end
end
)
)
from
(
SELECT??? /* INTn, FLOATn, DATETIMEn and MONEYn types */
colid = c.colid,
column_name = c.name,
nullable =??? /* set nullability from status flag */
(case convert(smallint, convert(bit, c.status&8)) when 0 then "NOT NULL" else "" end),
type_name = rtrim(substring(isnull(stuff(d.type_name,
(c.status&128)/128,
char_length(d.type_name),
"numeric identity"), d.type_name),
1+isnull(d.aux,
ascii(substring("III<<
2*(d.ss_dtype%35+1)+2-8/c.length,
1))-60), 18)),
"precision" = isnull(convert(int, c.prec),
isnull(convert(int, d.data_precision),
convert(int,c.length)))
+isnull(d.aux, convert(int,
ascii(substring("???AAAFFFCKFOLS",
2*(d.ss_dtype%35+1)+2-8/c.length,1))-60)),
scale = isnull(convert(smallint, c.scale),
convert(smallint, d.numeric_scale))
+convert(smallint,
isnull(d.aux,
ascii(substring("<<<<<<<<<<<<<",
2*(d.ss_dtype%35+1)+2-8/c.length,
1))-60))
FROM
syscolumns c,
sysobjects o,
sybsystemprocs.dbo.spt_datatype_info d,
systypes t
WHERE
o.id = @table_id
AND c.id = o.id
AND c.usertype = t.usertype
AND t.type = d.ss_dtype
AND d.ss_dtype IN (111, 109, 38, 110, 43)??? /* Just *N types */
AND c.usertype < 100??? ??? /* No user defined types */
UNION
SELECT??? /* All other types including user data types */
colid = c.colid,
column_name = c.name,
nullable =??? /* set nullability from status flag */
(case convert(smallint, convert(bit, c.status&8)) when 0 then "NOT NULL" else "" end),
type_name = rtrim(substring(isnull(stuff(d.type_name,
(c.status&128)/128,
char_length(d.type_name),
"numeric identity"), d.type_name),
1+isnull(d.aux,
ascii(substring("III<<
2*(d.ss_dtype%35+1)+2-8/c.length,
1))-60), 18)),
"precision" = isnull(convert(int, c.prec),
isnull(convert(int, d.data_precision),
convert(int,c.length)))
+isnull(d.aux, convert(int,
ascii(substring("???AAAFFFCKFOLS",
2*(d.ss_dtype%35+1)+2-8/c.length,1))-60)),
scale = isnull(convert(smallint, c.scale),
convert(smallint, d.numeric_scale)) +
convert(smallint, isnull(d.aux,
ascii(substring("<<<<<<<<<<<<<",
2*(d.ss_dtype%35+1)+2-8/c.length,
1))-60))
FROM
syscolumns c,
sysobjects o,
sybsystemprocs.dbo.spt_datatype_info d,
systypes t
WHERE
o.id = @table_id
AND c.id = o.id
AND c.usertype = t.usertype
AND t.type = d.ss_dtype
AND (d.ss_dtype NOT IN (111, 109, 38, 110, 43) /* No *N types */
OR c.usertype >= 100) /* User defined types */
) a
ORDER BY colid
end
go
------=================================================================================
存儲過程sp_desc的語法請 :下載
總結
以上是生活随笔為你收集整理的java怎么插入oracle数据库timenstamp,Sybase数据库技术,数据库恢复专家的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 彩信的基本原理
- 下一篇: C++ delete [] 与 del