Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: How to insert a space after each Manager Starts.

Re: How to insert a space after each Manager Starts.

From: Tim Kearsley <tim.kearsley_at_milton-keynes.gov.uk>
Date: 30 Jun 2003 06:52:14 -0700
Message-ID: <725736ef.0306300552.481881f1@posting.google.com>


navinsm2_at_rediffmail.com (Navin) wrote in message news:<5dc7f532.0306300050.2913b7a2_at_posting.google.com>...
> hi,
> guys
> i have query which given below output given below
>
> manager personlevel person name
> 2085 1 Howard Wilson1
> 2085 2 Howard Wilson2
> 2085 3 Howard Wilson3
> 2085 4 Howard Wilson4
> 2085 5 Howard Wilson5
> 6086 1 Andrew Saxon
> 6086 2 Andrew Saxon
> 6086 3 Ian Thompson
> 6086 4 Ian Thompson
> 6086 5 Phil Dargan
>
> what i want is after a manager ends i want a null to be inserted for
> each of there columns
> so that i can distinguish that when a new manager starts
>
> so that output looks like this
>
> manager personlevel person name
> 2085 1 Howard Wilson1
> 2085 2 Howard Wilson2
> 2085 3 Howard Wilson3
> 2085 4 Howard Wilson4
> 2085 5 Howard Wilson5
> null null null
> 6086 1 Andrew Saxon
> 6086 2 Andrew Saxon
> 6086 3 Ian Thompson
> 6086 4 Ian Thompson
> 6086 5 Phil Dargan
>
> Brlliant minds any solution for this..
> i know can i loop through the records and do it
> and check for a new manager
> but i want a better solution ..
> give me your ideads folks..
>
> Regards,
> Navin Mahindroo

Hello Navin,

If I'm interpreting what you want to do correctly, I think the easiest way is to use the SQLPlus "BREAK" command. This takes the form:

BREAK ON <Column alias> <Action>

and what it does is to look at the values in the column defined by <Column alias> and whenever that value changes it performs the action defined by <Action>. Thus you could say:

BREAK ON manager SKIP 2

and every time the value in column manager changes the query output includes a couple of blank lines. The default action with the BREAK command is that the value of the column you BREAK on is only printed each time the value changes (or at the top of a new page) but if you specifically want the value to be printed for every line add the keyword DUPLICATES (or DUP).

It probably hardly needs saying that to get a sensible output you need to ORDER BY the column(s) you BREAK on!

Hope that helps.

Regards,

Tim Kearsley
Database Manager
Milton Keynes Council Received on Mon Jun 30 2003 - 08:52:14 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US