I have to assume that you want the set of people, by department, that make the TOP salary in that dept. See, totally different answers to your query with the same data This is why I have a chapter in my new book on "don't tune a query, tune a question" Table create table dept as select * from pt ġ4 rows update emp set sal = 3000 where rownum = 1 Table create table emp as select * from scott.emp PL/SQL procedure successfully select substr( :x, rownum, 1 ) Package body set autoprint variable x exec demo_pkg.get_query( :x, '1', '1' ) Package create or replace package body demo_pkgĤ procedure get_query( p_cursor in out rc, p_start date, p_end date )ĩ for i in 1. Here is an example of what I mean by create or replace package demo_pkgĥ procedure get_query( p_cursor in out rc, p_start date, p_end date ) Since the number of columns is dynamic - every time you run this "query" they could be different - you'll use a stored procedure which returns a dynamically opened ref cursor (not a view - a view would be useless here)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |