LarrySteele
Programmer
This isn't rocket science, but I'm hitting a mental block that I can't seem to get past. Google works great if you know how to frame your question in a few words, but haven't figured the magic words to ask.
Given a string of table names like this: [tt]'HIS_TABLE,HER_TABLE,MY_TABLE,YOUR_TABLE'[/tt], how do I walk through each and send it as part of a SQL select?
I have a function setup that accepts a single table name and gives me the required return. What I need is one that allows me to walk through a comma-separate list of table name(s) and gives me the status for all.
Here's the function I have that gives me a return based on a single table:
Function works great. I'm trying to figure out is how to go through a comma-separated list of table name(s) and run each through this function.
In other languages I'd go to the split() function, but not so here.
TIA,
Larry
Given a string of table names like this: [tt]'HIS_TABLE,HER_TABLE,MY_TABLE,YOUR_TABLE'[/tt], how do I walk through each and send it as part of a SQL select?
I have a function setup that accepts a single table name and gives me the required return. What I need is one that allows me to walk through a comma-separate list of table name(s) and gives me the status for all.
Here's the function I have that gives me a return based on a single table:
Code:
CREATE OR REPLACE function dep_tbl_load(tbl_name varchar2)
return varchar2
is
-- given a table name, see if it was successfully loaded today
-- return 'Y' if yes, otherwise 'N'
v_recs number;
begin
select count(1)
into v_recs
from hrdm_load_stats
where bad_load = 'N'
and load_date = to_date(sysdate)
and table_name = tbl_name;
if v_recs = 1 then
return 'Y';
else
return 'N';
end if;
exception
when others then
dbms_output.put_line('Error in dep_tbl_load function: ' || to_char(sqlcode) || '-' || sqlerrm);
end;
/
Function works great. I'm trying to figure out is how to go through a comma-separated list of table name(s) and run each through this function.
In other languages I'd go to the split() function, but not so here.
TIA,
Larry