1 package body sqljutl is
2
3 function has_default(l_owner varchar2,
4 proc varchar2,
5 seq number,
6 ovr varchar2 DEFAULT NULL,
7 pkg_nm varchar2 DEFAULT NULL) return number is
8 def char := NULL;
9 begin
10 begin
11 if pkg_nm IS NULL
12 then
13 if ovr is NULL
14 then
15 select upper(DEFAULTED) INTO def FROM ALL_ARGUMENTS
16 WHERE OBJECT_NAME = proc AND OWNER = l_owner
17 AND SEQUENCE = seq and OVERLOAD is NULL and PACKAGE_NAME is NULL;
18 else
19 select upper(DEFAULTED) INTO def FROM ALL_ARGUMENTS
20 WHERE OBJECT_NAME = proc AND OWNER = l_owner
21 AND SEQUENCE = seq and OVERLOAD = ovr and PACKAGE_NAME IS NULL;
22 end if;
23 else
24 if ovr is NULL
25 then
26 select upper(DEFAULTED) INTO def FROM ALL_ARGUMENTS
27 WHERE OBJECT_NAME = proc AND OWNER = l_owner
28 AND SEQUENCE = seq and OVERLOAD is NULL and PACKAGE_NAME = pkg_nm;
29 else
30 select upper(DEFAULTED) INTO def FROM ALL_ARGUMENTS
31 WHERE OBJECT_NAME = proc AND OWNER = l_owner
32 AND SEQUENCE = seq and OVERLOAD = ovr and PACKAGE_NAME = pkg_nm;
33 end if;
34
35 end if;
36
37 EXCEPTION
38 WHEN NO_DATA_FOUND THEN
39 return 0;
40 WHEN OTHERS THEN
41 raise_application_error(-20001,'Error - '||SQLCODE||' -ERROR- '||SQLERRM);
42
43 end;
44
45 if def = 'N'
46 then return 0;
47 else return 1;
48 end if;
49 return 0;
50 end has_default;
51
52 procedure get_typecode
53 (tid raw, code OUT number,
54 class OUT varchar2, typ OUT number) is
55 m NUMBER;
56 begin
57 SELECT typecode, externname, externtype INTO code, class, typ
58 FROM TYPE$ WHERE toid = tid;
59 exception
60 WHEN TOO_MANY_ROWS
61 THEN
62 begin
63 SELECT max(version#) INTO m FROM TYPE$ WHERE toid = tid;
64 SELECT typecode, externname, externtype INTO code, class, typ
65 FROM TYPE$ WHERE toid = tid AND version# = m;
66 end;
67 end get_typecode;
68
69 function bool2int(b BOOLEAN) return INTEGER is
70 begin if b is null then return null;
71 elsif b then return 1;
72 else return 0; end if;
73 end bool2int;
74
75 function int2bool(i INTEGER) return BOOLEAN is
76 begin if i is null then return null;
77 else return i<>0;
78 end if;
79 end int2bool;
80
81 function ids2char(iv DSINTERVAL_UNCONSTRAINED) return CHAR is
82 res CHAR(19);
83 begin
84 res := iv;
85 return res;
86 end ids2char;
87
88
89 function char2ids(ch CHAR) return DSINTERVAL_UNCONSTRAINED is
90 iv DSINTERVAL_UNCONSTRAINED;
91 begin
92 iv := ch;
93 return iv;
94 end char2ids;
95
96 function iym2char(iv YMINTERVAL_UNCONSTRAINED) return CHAR is
97 res CHAR(9);
98 begin
99 res := iv;
100 return res;
101 end iym2char;
102
103 function char2iym(ch CHAR) return YMINTERVAL_UNCONSTRAINED is
104 iv YMINTERVAL_UNCONSTRAINED;
105 begin
106 iv := ch;
107 return iv;
108 end char2iym;
109
110 -- SYS.URITYPE and VARCHAR2
111 function uri2vchar(uri SYS.URITYPE) return VARCHAR2 is
112 begin
113 return uri.geturl;
114 end uri2vchar;
115
116 end sqljutl;