473,395 Members | 2,467 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Different answer sql*plus and oracle forms

10
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.
Nov 4 '08 #1
9 3319
Pilgrim333
127 100+
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.
Nov 4 '08 #2
amitpatel66
2,367 Expert 2GB
under which trigger you have defined this code in forms??.
Nov 4 '08 #3
ghssal
10
The trigger i have defined this code in forms under
WHEN-VALIDATE-ITEM
Nov 4 '08 #4
ghssal
10
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;
Nov 4 '08 #5
Pilgrim333
127 100+
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.
Nov 4 '08 #6
amitpatel66
2,367 Expert 2GB
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.
Nov 5 '08 #7
Pilgrim333
127 100+
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

Expand|Select|Wrap|Line Numbers
  1. select .....
  2. from  customer_order c
  3. where c.customer_id = :customer_id 
  4. and   c.order_date = 
  5.     (select max(o.order_date) 
  6.      from customer_order o
  7.      where o.customer_id = c.customer_id
  8.     ) 
  9.  
Pilgrim.
Nov 5 '08 #8
ghssal
10
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.
Nov 7 '08 #9
ghssal
10
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

Expand|Select|Wrap|Line Numbers
  1. select .....
  2. from  customer_order c
  3. where c.customer_id = :customer_id 
  4. and   c.order_date = 
  5.     (select max(o.order_date) 
  6.      from customer_order o
  7.      where o.customer_id = c.customer_id
  8.     ) 
  9.  
Pilgrim.


Thanks to you because of your efforts. The problem are solve
Nov 7 '08 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

2
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...
3
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"....
3
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
3
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
1
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...
2
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...
1
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...
0
DTV12345
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...
2
Parul Bagadia
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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...
0
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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...
0
marktang
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,...
0
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...
0
jinu1996
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...
0
tracyyun
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.