Reputation: 1733
How do you unit test the following procedure:
procedure some_prc as
begin
select t.a, t.b, t.c, t.d, count(*) from t inner join t1 on t.f1 = t1.f2
group t.a, t.b, t.c, t.d;
end;
the query is run by sqlplus.
Upvotes: 0
Views: 401
Reputation: 132580
To perform an automated, repeatable unit test would require an environment where you have total control of the data - e.g. a local install of the database on your own PC, or a dedicated database or schema on the server that only you can access.
Only then can you do what you would need to do i.e.
Even in a controlled environment you are going to have complications if your data involves dates, since the value of SYSDATE is probably not under your control!
There is a mechanism for Unit Tests along these lines built into SQL Developer. Also there is a tool call utPLSQL you could investigate. I can't recommend for or against either as I haven't really used them.
Upvotes: 2