UNI STUDENT NEEDS HELP! - POST-CHANGE TRIGGER

Debsy23
Debsy23 used Ask the Experts™
on
This will be an easy one for any experts!

I am doing a project on Oracle at uni and only have basic knowledge of Oracle.

I want to retrieve data into 3 display items from one code.

Ie: I have a clinic code and have created 3 display items for clinic_description, start_time and end_time.

How do I write the PL/SQL for the trigger to display all data in one go? I only know how to display it for one item.

So far it looks like this:
select clinic_description
into :clinic_appoint.clinic_description
from clinic
where :clinic_appoint.clinic_code=clinic.clinic_code;

I need the start_time & end_time to display in the clinic_appoint form as well.

Thanks!
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
in which table are start_time and end_time stored? let's say they are stored in tableX

u would do something like

select clinic_description, start_time, end_time
into :clinic_appoint.clinic_description,
     :clinic_appoint.start_time,
     :clinic_appoint.end_time,
from clinic, tableX
where :clinic_appoint.clinic_code=clinic.clinic_code
and :clinic_appoint.clinic_code = tableX.clinic_code;

hope u get the idea
vemul
Guy Hengel [angelIII / a3]Billing Engineer
Most Valuable Expert 2014
Top Expert 2009

Commented:

Commented:
hi debsy23,
 if the suggestion I proposed helped you and u are satisfied with it, could u please accept my comment and close this question

thanks,
vemul
Exploring ASP.NET Core: Fundamentals

Learn to build web apps and services, IoT apps, and mobile backends by covering the fundamentals of ASP.NET Core and  exploring the core foundations for app libraries.

Author

Commented:
Sorry vemul for not accepting the answer yet, it is only because I can't get it to work yet. All the info was stored in the same table 'clinic' so when I changed it to suit, it looked like this:

select clinic_description, start_time, end_time
into :clinic_appoint.clinic_description,
    :clinic_appoint.start_time,
    :clinic_appoint.end_time,
from clinic
where :clinic_appoint.clinic_code=clinic.clinic_code;

It says that there is a problem with 'from'. I have tried variations.

Commented:
what exactly did it say the problem was?. also can I presume clinic_description, start_time, stop_time are in the same table clinic?

Author

Commented:
Yes, they are all in the same table. It said 'encountered the symbol 'from' when expecting one of the following... mod <an identifier><a double-quoted delimited-identifier><a bind-variable>current sql<a single-quoted sql string>
The symbol "<an identifier>" was substituted for FROM to continue.

Which didn't give me much insight I am afraid.
Commented:
I think it is because of the additional comma in
   :clinic_appoint.end_time,

did u try this..
select clinic_description, start_time, end_time
into :clinic_appoint.clinic_description,
   :clinic_appoint.start_time,
   :clinic_appoint.end_time
from clinic
where :clinic_appoint.clinic_code=clinic.clinic_code;

Author

Commented:
Thanks so much Vemul - its such a small change, but makes all the difference.

Commented:
it was actually my mistake but glad we got it figured out..

good luck
vemul

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial