Home » SQL & PL/SQL » SQL & PL/SQL » Accept Command
Accept Command [message #23649] Sat, 21 December 2002 04:40 Go to next message
CreativePresence
Messages: 73
Registered: December 2002
Member
I have the following command where it allows the user to specify an particular salesman id (repid [[4 DIGIT NUMBER]]) or by typing "ALL"(CHAR) will display all records, but i also require the user to be able to enter a date & if the date matches an order date to bring up this record. The order date is on the table called "ord" and is called "OrderDate" and the date on the order table is formated as "DD-MMM-YY".
To put it directly, i want one accept command where the user can either enter a repid, All or a date.
I have tried various ways, but with little joy & therefore turning to the experts. Any advise or assistance would be greatful. Is this possible or would i need to approach it from a diff. angle?
Set Linesize 150
Set Pagesize 75
PROMPT To view a report on sales orders based on a salesman, please type his/her "Rep ID" number or type
PROMPT "ALL" to view all orders by all salemen. To view an order by date, enter a valid date.
Accept UserRequest CHAR PROMPT 'Please enter "RepID, ALL or Date of Order.: '
Set Verify Off
Select Distinct Cust.RepID, Cust.Name "Customer Name", Ord.OrdID "Order ID", Ord.OrderDate "Order Date",
Item.ItemTot "Item Total", Item.Qty "Quantity", Ord.Total "Order Total"
From Emp, Customer Cust, Item, Ord
Where ('&USERREQUEST'='ALL' OR instr('&USERREQUEST', to_char(Emp.EmpNo))>0)
and Emp.Empno = Cust.RepID
and Cust.CustID = Ord.CustID
and Ord.OrdID = Item.OrdID
/
Re: Accept Command [message #23652 is a reply to message #23649] Sat, 21 December 2002 05:35 Go to previous message
Barbara Boehmer
Messages: 9094
Registered: November 2002
Location: California, USA
Senior Member
Please click on the link below for my response to your other duplicate post in the newbies forum:

Previous Topic: Accept Command
Next Topic: Using SQL%Rowcount inside trigger
Goto Forum:
  


Current Time: Thu May 16 20:39:48 CDT 2024