473,657 Members | 2,513 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Different answer sql*plus and oracle forms

10 New Member
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=194 5.
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 3331
Pilgrim333
127 New Member
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 Recognized Expert Top Contributor
under which trigger you have defined this code in forms??.
Nov 4 '08 #3
ghssal
10 New Member
The trigger i have defined this code in forms under
WHEN-VALIDATE-ITEM
Nov 4 '08 #4
ghssal
10 New Member
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 New Member
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 Recognized Expert Top Contributor
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 New Member
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 New Member
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 New Member
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
4959
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 this line in SQL*Plus context FROM ifssys.ifs_folder_items WHERE Folder_Name = 'Root Folder' AND TYPE = 'FOLDER'; -> PL/SQL: ORA-00942: table or view does not exist
3
3692
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". It display for me all the record in the database and then it also display how many record has been selected. but if i try to do this: "select * from customer" or select any table it still display all the record in that table but it didn't...
3
15045
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
20061
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
4313
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 server from SQL*Plus of the client. I know it can be done from SQL*Plus of the server but the point is that I want to do it from SQL*Plus of the Client. Many many thnx for any tips, Miori
2
4128
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 an SQL environment up so I can code in that then just paste it into SQL *Plus later. I don't really want to install Oracle on my home pc and I was wondering if there are other IDE's for SQl that would fit my need for this.
1
1887
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 installation was successfull. But when i tried to access from command line, i was prompted to enter username and password. I have no clue to what should i provide as username and password. This spits out an error as "ORA-12560: TNS:protocol adapter...
0
2511
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 specify in a BREAK command is called a break column which suppresses duplicate values. For example SQL> BREAK ON DEPTNO SKIP 1 // To insert a blank line SQL> SELECT DEPTNO, ENAME, SAL 2 FROM EMP 3 WHERE...
2
1286
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 as internal and password as scott and nothing to be written in host string. It worked just an hour before; i dont know how but the same thing is not workin now.... 2 months before i had read a book on pl/sql which was havin many chapters on how to...
0
8413
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8324
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8842
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8740
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8617
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7352
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4330
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2742
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1970
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.