Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE : Re:RE : Displaying Title When No Data Returned
Wayne,
Playing with SET EMBEDDED ON/OFF might do the trick. Define your title, write a 'hidden' SELECT FROM DUAL which always returns something, SET EMBEDDED ON, your query, SET EMBEDDED OFF. This way your query will start on the same page (same title) as the SELECT FROM DUAL whatever happens.
-- Regards, Stephane Faroult email: sfaroult_at_oriolecorp.com Oriole Corporation Voice: +44 (0) 7050-696-269 Fax: +44 (0) 7050-696-449 Performance Tools & Free Scripts ------------------------------------------------------------------ http://www.oriolecorp.com, designed by Oracle DBAs for Oracle DBAs ------------------------------------------------------------------Received on Mon Sep 18 2000 - 03:19:00 CDT
>
> Many of you replied with the same (or at least similar) solution.
> Unfortunately, it does not give me the desired results. This tells me that I
> probably was not clear enough on my request.
>
> Here is what I want.
>
> If the query gives back data, then I want the title (which has a page number on
> it) to display normally, (with the appropriate page numbers, etc.). If the
> query does not give back data, then I want the title to display (with page 1).
>
> The results I get with the solution many of you gave is correct ONLY if there is
> NO DATA. However, if there IS DATA, then the title will display once with NO
> DATA and then again with the data.
>
> AND for the person who says "just turn the title off before you do the real
> query", then I will only get the title on the first page of the report, which is
> not acceptable to our users.
>
> However, I believe I have come up with a solution to the problem.
> The solution is:
> 1) Define a "bogus" column with the NOPRINT option
> 2) Issue the statement BREAK ON REPORT
> 3) Issue the statement COMPUTE COUNT OF bogus ON REPORT
> 4) Add the "bogus" column to your report
>
> For example, if I do the following:
>
> ttitle center 'Sample Title' -
> right 'PAGE: ' format 999 sql.pno skip
> column bogus noprint
> break on report
> compute count of bogus on report
>
> If I issue my query with the "bogus" column, WITH DATA, I get:
> SQL> select NULL "bogus", dummy from dual where 1 = 1;
>
> Sample Title PAGE: 1
> D
> -
> X
>
> If I issue my query with the "bogus" column, WITHOUT DATA, I get:
> SQL> select NULL "bogus", dummy from dual where 1 = 2;
>
> Sample Title PAGE: 1
> D
> -
>
> Not elegant, but it seems to work. Anyone have a better way?
![]() |
![]() |