CREATE PROCEDURE PRO_LENTH(LEN OUT NUMBER) AS BEGIN select LENGTH(COL) INTO LEN FROM TAB; EXECPTION WHEN OTHERS THEN DBMS_OUTPUT.PUTLINE('ERROR'); END;
没听懂你的意思。 如果是在查询语句中的话直接 SELECT LENGTH(C1) FROM T; 如果你说的是存储过程中的话: declare v_length_c1 number; begin select length(c1) into v_length_c1 from t; dbms_output.put_line(v_length_c1); end;
m constant integer := 5; begin select INSTR(bar,(select 条码 from BOMKABAIRBAG where 条码 like substr(bar,1,m)),1,1) into x2 from dual; if (x2 = 1 and barchk = 0) then -- x2<>2 begin --insert into KABOPTABLE(barcode2) values(bar); rchk := 2; goto endofproc; end; end if; exception when others then rchk := 0; end;上面是原来存储的一部分代码。其中m是固定的条码长度。现在我想做成可变的长度 就是怎么把select length(条码) from BOMKABAIRBAG;这个获取的长度在这个存储中付给m那? 注现在的条码长度是可变的。
我想你需要一个数组变量,不知道你是不是这个意思,呵呵type type_arr is table of integer index by binary_integer; arr_aa type_arr; select length(条码) into aa from BOMKABAIRBAG;
select length(col) from tb
(bar in varchar2,barchk in integer,rchk out integer) ism number; x1 integer; x2 integer; x3 integer; begin select length(条码) into m from BOMKABAIRBAG; select INSTR(bar,(select 条码 from BOMKABAIRBAG where 条码 like substr(bar,1,m)),1,1) into x2 from dual; if (x2 = 1 and barchk = 0) then -- x2<>2 begin --insert into KABOPTABLE(barcode2) values(bar); rchk := 2; goto endofproc; end; end if; exception when others then rchk := 0; end;
(bar in varchar2,barchk in integer,rchk out integer) ism number; x1 integer; x2 integer; x3 integer; begin select length(条码) into m from BOMKABAIRBAG; select INSTR(bar,(select 条码 from BOMKABAIRBAG where 条码 like substr(bar,1,m)),1,1) into x2 from dual; if (x2 = 1 and barchk = 0) then -- x2<>2 begin --insert into KABOPTABLE(barcode2) values(bar); rchk := 2; goto endofproc; end; end if; exception when others then rchk := 0; end;
AS
BEGIN
select LENGTH(COL) INTO LEN FROM TAB;
EXECPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUTLINE('ERROR');
END;
如果是在查询语句中的话直接
SELECT LENGTH(C1) FROM T;
如果你说的是存储过程中的话:
declare
v_length_c1 number;
begin
select length(c1) into v_length_c1 from t;
dbms_output.put_line(v_length_c1);
end;
m constant integer := 5; begin
select INSTR(bar,(select 条码 from BOMKABAIRBAG where 条码 like substr(bar,1,m)),1,1) into x2 from dual;
if (x2 = 1 and barchk = 0) then -- x2<>2
begin
--insert into KABOPTABLE(barcode2) values(bar);
rchk := 2;
goto endofproc;
end;
end if;
exception
when others then
rchk := 0;
end;上面是原来存储的一部分代码。其中m是固定的条码长度。现在我想做成可变的长度
就是怎么把select length(条码) from BOMKABAIRBAG;这个获取的长度在这个存储中付给m那?
注现在的条码长度是可变的。
arr_aa type_arr;
select length(条码) into aa from BOMKABAIRBAG;
ism number;
x1 integer;
x2 integer;
x3 integer; begin
select length(条码) into m from BOMKABAIRBAG;
select INSTR(bar,(select 条码 from BOMKABAIRBAG where 条码 like substr(bar,1,m)),1,1) into x2 from dual;
if (x2 = 1 and barchk = 0) then -- x2<>2
begin
--insert into KABOPTABLE(barcode2) values(bar);
rchk := 2;
goto endofproc;
end;
end if;
exception
when others then
rchk := 0;
end;
ism number;
x1 integer;
x2 integer;
x3 integer; begin
select length(条码) into m from BOMKABAIRBAG;
select INSTR(bar,(select 条码 from BOMKABAIRBAG where 条码 like substr(bar,1,m)),1,1) into x2 from dual;
if (x2 = 1 and barchk = 0) then -- x2<>2
begin
--insert into KABOPTABLE(barcode2) values(bar);
rchk := 2;
goto endofproc;
end;
end if;
exception
when others then
rchk := 0;
end;