请教,将MS-SQL 转换为Orcale 多谢啦 CREATE FUNCTION dbo.f_str(@f_value_id varchar(10)) RETURNS varchar(100) AS BEGIN DECLARE @re varchar(100) SET @re='' SELECT @re=@re+';'+CAST(f_value as varchar) FROM zte_cmmia_rs_subp_pu WHERE f_value_id=@f_value_id RETURN(STUFF(@re,1,1,'')) END
------解决方案-------------------- CREATE FUNCTION dbo.f_str(in_f_value_id varchar) RETURNS varchar(100) AS re varchar(100) ; BEGIN
re:='' ; SELECT ';'||to_char(f_value) into re FROM zte_cmmia_rs_subp_pu WHERE f_value_id=in_f_value_id ; RETURN re END
------解决方案--------------------
SQL code
CREATE FUNCTION dbo.f_str(in_f_value_id varchar)
RETURNS varchar(100)
AS
re varchar(100) ;
BEGIN
re:='' ;
SELECT to_char(f_value)
into re
FROM zte_cmmia_rs_subp_pu
WHERE f_value_id=in_f_value_id ;
RETURN re ;
END
------解决方案--------------------
CREATE OR REPLACE FUNCTION f_str(xx VARCHAR2) RETURN VARCHAR2 AS re varchar(100); CURSOR v_c IS SELECT f_value FROM zte_cmmia_rs_subp_pu WHERE f_value_id=xx ; BEGIN FOR i IN v_c LOOP re:=re||';'||i.f_value; END LOOP; RETURN TRIM(leading ';' FROM re); END; /