Solved

Oracle && BDE

Posted on 2002-07-12
6
357 Views
Last Modified: 2013-11-23
What component should i use to define new stored procedure (Oracle) with BDE components ?
I try to define the following sql :
CREATE OR REPLACE TRIGGER triggername
BEFORE INSERT
ON my_table  --must exist, create it if not
FOR EACH ROW
BEGIN
 IF ID IS NULL THEN
   SELECT my_seq.nextval  -- must exist, create it if not

     INTO :NEW.ID  -- :NEW missed
     FROM DUAL;
 END IF;
END;

in TQuery.sql property and tQuery.execSql
 and got error :
Query Field NEW is from unknown type ...
0
Comment
Question by:asi
  • 5
6 Comments
 
LVL 27

Expert Comment

by:kretzschmar
ID: 7148471
you can't

use sql+ instead
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 7148474
btw.
this
IF ID IS NULL THEN
 
should be
IF :NEW.ID IS NULL THEN
 
meikl ;-)
0
 

Author Comment

by:asi
ID: 7148578
Ok, i finally success to do the following steps:

1)
create table try4 (id number,text_col varchar2(80))
2)
    CREATE OR REPLACE TRIGGER Inc_Field_onTry4
    BEFORE INSERT
    ON try4  --must exist, create it if not
    FOR EACH ROW
    BEGIN
    IF :NEW.ID IS NULL THEN
    SELECT my_seq.nextval  -- must exist, create it if not
    INTO :NEW.ID  -- :NEW missed
    FROM DUAL;
    END IF;
    END;

But when i try to execute
INSERT INTO TRY4 (text_col)  VALUES('as111')  
i got ORA-04098
why ?

;-)asi
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 27

Accepted Solution

by:
kretzschmar earned 50 total points
ID: 7148601
ORA-04098 trigger 'string.string' is invalid and failed re-validation
Cause: A trigger was attempted to be retrieved for execution and was found to
be invalid. This also means that compilation/authorization failed for the
trigger.
Action: Options are to resolve the compilation/authorization errors, disable
the trigger, or drop the trigger.

---

your trigger isn't valid

check if the sequence exists,
if yes, create a public synonym for the sequence

check if the table exists,
if no, create it

triggercode itself looks good now

do you have any tool, like toad?
(if not, i guess there is a trial version at www.quest.com)

btw. toad is coded with delphi

it makes your life with oracle a bit easier
(is more comfortable as sql+)

meikl ;-)
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 7148606
here you can download the trial from toad

http://www.quest.com/requests/?RequestDefID=49

if you have it, you can examine
your trigger and find out what is missed

meikl ;-)
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 7179533
hello?
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question