Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TOAD - Data display, highlight PK field 1

Status
Not open for further replies.

Andrzejek

Programmer
Jan 10, 2006
8,529
US
In TOAD for Oracle, there is a setting in View - TOAD Options... - Schema Browser - Data Tab: highlight columns populated by sequence/trigger pair (checkbox)

TOAD_mtuwms.png


TOAD Help said:
Highlight columns populated by sequence/trigger pair

When a sequence/trigger pair has been created, selecting this option highlights any columns populated by that method. This option is only applicable in the Schema Browser data grids, not those in the Editor, although the trigger/sequence pair will still populate the column there.

I do have a whole bunch of PK fields set for many tables with sequence/trigger pairs, but TOAD does not highlight these columns.... Why not [ponder]



---- Andy

There is a great need for a sarcasm font.
 
Did you make them manually, or through the toad option on the schema browser . When you use the Toad option to make the trigger/sequence pair the following comment is inserted during the create immediately after the BEGIN clause in the trigger

-- For Toad: Highlight column ID

For example

Code:
CREATE OR REPLACE TRIGGER JOB_RUN_LOG_TRG
BEFORE INSERT
ON JOB_RUN_LOG
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
DECLARE
  N NUMBER;
BEGIN
-- For Toad:  Highlight column ID
  Select JOB_RUN_LOG_SEQ.nextval into n from dual;
  :new.ID := N;
END JOB_RUN_LOG_TRG;
/


Bill
Lead Application Developer
New York State, USA
 
>Did you make them manually
Well, kind of, but not "through the toad option on the schema browser" (I don't really know how to do that in TOAD - how do "you use the Toad option to make the trigger/sequence pair"?).

I have another little app where I specify a few variables: PK field name, sequence name, trigger name, etc. and all that Primary Key/sequence/trigger magic happens. I have a whole bunch of tables without PK, and now they need PK to be established. I've been asking for this for years, and now it happens...

Is there a way to introduce this [tt]-- For Toad: Highlight column ID[/tt] line to already existing table scipt?


---- Andy

There is a great need for a sarcasm font.
 
Fairly Simple, right click on the table you want to add a sequence on. It must have a column defines as a number then select the option, see image below

toad_doka7i.jpg


you can also simply edit the trigger and put the string

-- For Toad: Highlight column ID

on the first line after the "BEGIN" statement in the trigger

Bill
Lead Application Developer
New York State, USA
 
Thanks, this is nice. And I am sure it works great for a new table with no records. Unfortunately, I have to deal with existing tables with many records. I am sure I can use this way of setting the trigger/sequence pair, but then I would have to populate the PK field with the values from the sequence, etc.

Aaah, edit the trigger. [thumbsup2]




---- Andy

There is a great need for a sarcasm font.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top