我想提出一个问题,获得结果,然后利用我在第2次发言中第一次发言(审计员)的价值观,用另一种选择发言来表示。
I have 40 users in my db. All the users have the same db schema structure. I want to get the username via :
SELECT distinct username
from all_users
之后,使用用户名称来进行这样的询问:
Select lastname, firstname, email, email2 from username.member.
我的一套成果将回归多个阶层,因此我也需要一种增长模式。
I have tried many different pl/sql combinations:
DECLARE
CURSOR client_cur IS
SELECT distinct username
from all_users
where length(username) = 3;
-- client cursor
CURSOR emails_cur (cli all_users.username%TYPE) IS
SELECT id, name
FROM cli.org;
BEGIN
FOR client IN client_cur LOOP
dbms_output.put_line( Client is || client.username);
FOR email_rec in client_cur(client.username) LOOP
dbms_output.put_line( Org id is ||email_rec.id || org nam || email_rec.name);
END LOOP;
END LOOP;
END;
/
以及
DECLARE
CURSOR c1 IS
SELECT distinct username from all_users where length(username) = 3;
client c1%rowtype;
cursor c2 is Select id, name, allow_digest_flg from c1.username.org;
digest c2%rowtype;
-- declare record variable that represents a row fetched from the employees table
-- employee_rec c1%ROWTYPE;
BEGIN
-- open the explicit cursor 以及use it to fetch data into employee_rec
OPEN c1;
loop
FETCH c1 INTO client;
open c2;
loop
fetch c2 into digest;
DBMS_OUTPUT.PUT_LINE( digest is : || c2.id || 以及name is || c2.name || flg is || c2.allow_digest_flg );
end loop;
end loop;
END;
/
以及大饥荒。
Can someone help me. THANKS