我必须为oracle重写一个t-sql函数,所以我想询问是否有可能在Oracle数据库上做类似的事情:
CREATE FUNCTION [dbo].[fn_stor_text_convertion] (@str_in AS NVARCHAR(100))
RETURNS NVARCHAR(100) WITH RETURNS NULL ON NULL INPUT,
EXECUTE AS CALLER AS BEGIN
DECLARE @str_out NVARCHAR(100);
DECLARE @position INT;
DECLARE @char_code INT;
SET @position = 1 SET @str_out = ''
WHILE @position <= DATALENGTH(@str_in)
BEGIN
SET @char_code = UNICODE(SUBSTRING(@str_in, @position, 1))
SET @char_code =
CASE
WHEN @char_code = 184 THEN 235
WHEN @char_code < 192 THEN @char_code
ELSE @char_code + 848
END
SET @str_out = CONCAT(@str_out, NCHAR(@char_code))
SET @position
= @position + 1
END
RETURN(@str_out)
END