CREATE OR REPLACE PROCEDURE Users_Info AS v_OutFile UTL_FILE.FILE_TYPE; Cursor User_Info is SELECT * FROM ydgh.USERS@land where userid=201; RefUser User_Info%rowtype; --代表检索集 incount number; BEGIN incount := 0; open User_Info; v_OutFile := UTL_FILE.FOPEN('d:\log','Users_Info','w'); UTL_FILE.PUTF(v_OutFile,'%s %s\n','userid','数据有错误表现出来'); loop <<continue_label>> --重复调用 fetch User_Info into RefUser; exit when User_Info%notfound; INSERT INTO POWER.USERT(ID,NAME,LOGNAME,PASSWORD,GROUPID,ISOBSOLETE) VALUES(330,RefUser.USERNAME,'abc',RefUser.PASSWORD,2,0); end loop; close User_Info; UTL_FILE.FCLOSE(v_OutFile); END Users_Info; /
select * from all_users;
什么意思,是导出用户下的数据吗?
还是查出用户名,如果是那样的话,那就不是导出了。
AS
v_OutFile UTL_FILE.FILE_TYPE;
Cursor User_Info is
SELECT *
FROM ydgh.USERS@land where userid=201;
RefUser User_Info%rowtype; --代表检索集
incount number;
BEGIN
incount := 0;
open User_Info;
v_OutFile := UTL_FILE.FOPEN('d:\log','Users_Info','w');
UTL_FILE.PUTF(v_OutFile,'%s %s\n','userid','数据有错误表现出来');
loop
<<continue_label>> --重复调用
fetch User_Info into RefUser;
exit when User_Info%notfound;
INSERT INTO POWER.USERT(ID,NAME,LOGNAME,PASSWORD,GROUPID,ISOBSOLETE)
VALUES(330,RefUser.USERNAME,'abc',RefUser.PASSWORD,2,0);
end loop;
close User_Info;
UTL_FILE.FCLOSE(v_OutFile);
END Users_Info;
/