HI
I am using ORACLE forms and trying to insert a new order, by enter the customer_ID and i will get the latest order
för this customer and save the new order with new order_date.
I use this Trigger
select .....
from customer_order, (
select customer_ID AS B, MAX(order_date) AS S
from customer_order
GROUP BY customer_ID)
where :customer_ID = B and order_date = S;
IN ORCLE FORMS mode i get another customer_ID and order who share the 'order_date' and inserted before a pressing issue.
When i try in SQL PLUS i get the right customer_ID but i get three record for one order as
customer_ID order_date
------------ ----------
1945 2008/08/12
1945 2008/08/12
1945 2008/08/12
the table
customer_ID order_date
------------ ----------
1945 2007/04/15
1945 2007/05/01
1945 2007/05/04
1945 2008/08/12* This record came in SQL plus tree timesa.
1961 2008/09/09
1961 2007/02/07
1961 2008/08/12
1961 2001/01/01
1961 2004/04/04
1961 2006/06/06
1961 2008/08/12* this what i get in FORMS mode instead for customer_ID=1945.
1961 2008/08/12
1981 2008/08/12
Can you explian how i solve the problem and get the right order for the right customer_ID.
9 3319
Hi,
Just a few questions.
What kind of trigger is it?
Did you run the query in SQL*PLUS or did you just insert a record in SQL*PLUS?
Can you post the exact query you are using? The where part seems a bit faulty, you are using
:customer_ID = B
Pilgrim.
under which trigger you have defined this code in forms??.
The trigger i have defined this code in forms under
WHEN-VALIDATE-ITEM
1- The trigger i have defined this code in forms under
WHEN-VALIDATE-ITEM
2- I run the query in SQL*PLUS as
select customer_ID, order_date,......
from customer_order, (
select customer_ID AS B, MAX(order_date) AS S
from customer_order
GROUP BY customer_ID)
where customer_ID = 1945 and order_date = S;
Hi,
I think something is going wrong with the customer_id that is used in the trigger. Just after the query in your form, let a messagebox pop up with the value of the customer_id. If this is 1961, then put the messagebox at the start of the trigger and show it then.
Post here what the results were.
Pilgrim.
1- The trigger i have defined this code in forms under
WHEN-VALIDATE-ITEM
2- I run the query in SQL*PLUS as
select customer_ID, order_date,......
from customer_order, (
select customer_ID AS B, MAX(order_date) AS S
from customer_order
GROUP BY customer_ID)
where customer_ID = 1945 and order_date = S;
Please clarify couple of things:
1. The customer_id is passed from forms field?
2. Order date is passed from forms field?
Your query is incorrect.I would help you out in reframing your query once you clarify the above two points.
Indeed you query is incorrect.
The problem you have, is that you are comparing the value with form with the wrong table. Try this and see if it gives the same results as the query you want -
select .....
-
from customer_order c
-
where c.customer_id = :customer_id
-
and c.order_date =
-
(select max(o.order_date)
-
from customer_order o
-
where o.customer_id = c.customer_id
-
)
-
Pilgrim.
Please clarify couple of things:
1. The customer_id is passed from forms field?
2. Order date is passed from forms field?
Your query is incorrect.I would help you out in reframing your query once you clarify the above two points.
Yes, both the customer_id and Order date is passed from forms field.
Indeed you query is incorrect.
The problem you have, is that you are comparing the value with form with the wrong table. Try this and see if it gives the same results as the query you want -
select .....
-
from customer_order c
-
where c.customer_id = :customer_id
-
and c.order_date =
-
(select max(o.order_date)
-
from customer_order o
-
where o.customer_id = c.customer_id
-
)
-
Pilgrim.
Thanks to you because of your efforts. The problem are solve
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Ethel Aardvark |
last post by:
I have a query which runs fine in SQL*Plus but which will not compile
into a packaged procedure (claiming that the table can not be found):
SELECT DISTINCT Folder_ID
INTO l_RootID -- remove...
|
by: khangu |
last post by:
Hello!
i am a newbie in oracle database. I have some question about SQL*PLUS
Currently, i have some table in an oracle database. When i open
SQL*PLUS and type my query: "select * from employee"....
|
by: valexena |
last post by:
In order to set SQL*PLUS session so that NLS_DATE_FORMAT information is
altered in a specific way every time I log into Oracle which method
would be used?
--
Posted via http://dbforums.com
|
by: Peter |
last post by:
Has anyone seen this before?
I start SQL*Plus, and login by typing
sqlplus Quantum/Password@BPrd
I type:
select '&1' from dual;
it responds
|
by: Miori |
last post by:
Dear all,
Server machine running Oracle Database Server on Linux
and a Client machine running Oracle Client on WIndows XP.
HOw it is possible to shut down/start up the Oracle database
on the...
|
by: Ant |
last post by:
Hi,
I have an SQL assignment to do and at my school we use SQL *Plus there
however I don't have Oracle at home, where I would like to do the work ,so I
was wondering whats the easiest way to get...
|
by: gomathy |
last post by:
Hello All!
I am newbie to oracle. As a first step, i tried to install oracle sql*plus instant client on my machine to start working with sql simple commands like "table creation etc".
This...
|
by: DTV12345 |
last post by:
Greetings!
This is an excerpt from the Oracle documentation:"...ORACLE SQL*Plus BREAK command creates a subset of records and add space and/or summary lines after each subset. The column you...
|
by: Parul Bagadia |
last post by:
Hello people,
Actually i had taken my computer 1 year before and the vendor itself had installed oracle at that time only.
For the login purpose of SQL*PLUS, he had made a document having username...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |