0
我有下面的代碼作爲Oracle過程的一部分,需要幫助的轉換成PostgreSQL的程序 -轉換甲骨文代碼到PostgreSQL的
-- logic to send e-mail to multiple To'd users separated by ';'
v_temp := replace(p_recepient,' ','');
IF (instr(v_temp,';') = 0) OR (instr(v_temp,';') < length(v_temp))
THEN
v_temp := v_temp || ';';
END IF;
v_pos := 1;
WHILE (instr(v_temp,';',v_pos) > 0)
LOOP
v_name := substr(v_temp,v_pos,instr(substr(v_temp,v_pos),';') - 1);
v_pos := v_pos + instr(substr(v_temp,v_pos),';');
v_reply := utl_smtp.rcpt(conn,v_name);
END LOOP;
IF v_reply.code <> 250
THEN
utl_smtp.quit(conn);
RETURN;
END IF;
-- logic to send e-mail to multiple CC's users separated by ';'
v_temp1 := REPLACE(p_recpnt_cc,' ','');
IF (instr(v_temp1,';') = 0) OR (instr(v_temp1,';') < length(v_temp1))
THEN
v_temp1 := v_temp1 || ';';
END IF;
v_pos1 := 1;
WHILE (instr(v_temp1,';',v_pos1) > 0)
LOOP
v_name1 := substr(v_temp1,v_pos1/*1*/,instr(substr(v_temp1,v_pos1),';') - 1);
v_pos1 := v_pos1 + instr(substr(v_temp1,v_pos1),';');
v_reply1 := utl_smtp.rcpt(conn,v_name1);
END LOOP;
IF v_reply1.code <> 250
THEN
utl_smtp.quit(conn);
RETURN;
END IF;
正如你看到的上面的代碼有INSTR,SUBSTR其中不存在PostgreSQL中。
ERROR: syntax error at or near "IF"
LINE 94: IF (instr(v_temp,';') = 0) OR (instr(v_temp,';') < le...
^
********** Error **********
ERROR: syntax error at or near "IF"
SQL state: 42601
Character: 4028