How to write the SELECT statement
Commission of the CARDS0-20 0
21-25 500
26-31 650
32-36 850
37 > 1050
If a PERSON sells 28 cards in one month, commission would be calculated as below.
25 * 500 = 12500
3 * 650 = 1950
Total commission 14450
I guess that's what you're looking for...
CREATE TABLE WG (A NUMBER);
INSERT GT VALUES (0);
INSERT GT VALUES (28);
SELECT * FROM GT
0
28
SELECT THE CHECK BOX
WHEN IS > = 0 AND<=20 then="">=20>
WHEN WAS > = 21 AND HAS<=25 then="">=25>
WHEN WAS > = 26 AND HAS<=31 then="">=31>
WHEN WAS > = 32 AND HAS<=36 then="">=36>
WHEN > = 37 THEN 36 * 850 + (A-36) * 1050
ON THE OTHER
NULL VALUE
END TEST
THE GT;
Output:
0
14450
Thank you...
Tags: Database
Similar Questions
-
How to write the select query for it
Hello
I had an html form and the area I drop down and he needs to select several values in the drop-down box. When I select multiple values then I have to write the query to SQL select statement.
When I try to write the select statement and trying to run I get the error message.
Select * from Table
where emo_no = '1,2,3 '.
That's how I write the query please suggest me how to write the query to select several values in the drop-down box.
Thank you
Use the keyword sql 'in '. If you don't know how, I've heard good things about the book Teach Yourself SQL in 10 Minutes by Ben Forta.
-
How to use the select statement in loop for
Hi all
My question is can I use a select statement in for loop like as follows.
for the key in the selection of one_table key.
When I use this am getting an error as found select invalid I ID
How to select a statement use in loop for
Please suggest me.
Thank you
SreeHello
You can use code below
For key in (select button from table_a)
loop
If key.key = 1 then
-insert statement
on the other
-Select statement
end loop;Thank you
Naveen. -
[JS CS5] How to get the selected state of a multi-state object
Does anyone know if there is a way to identify the State of a multi-state object is selected?
You can select different States of an object of several State in the States Panel.
In the object model.
Mon_etat = app.selection [0].states.item (0);
myState.active = true;
.. .all the first State to the DSO. But I can't understand how to identify the State in which is currently visible. This doesn't seem to be possible in the object model, unless I'm missing something. Any ideas?
Hey!
Take a look at 'activeStateIndex' of MSO.
Hope that helps.
--
tomaxxi
-
How to write a select statement in which the condition?
Hello Frs,
Need help in the development of a discoverer report.
My requirement is to write a query similar to this one
Select * from emp is dept_no not in (select Department dept_no where emp_name like ' a % ;))
Help, please.
Thank you
RajeshHello
to do this exactly how you can do 1 of 3 things:
1 use the Discoverer Desktop edition (most didn't do it) and use the sub query option you will find in the conditions.
2. create a custom in the BA folder and create the report on the new custom folder
3. create a view of db that contain your selection, and then create a folder in the BA based on this point of view and then create your report.Tamir
-
How to write a select statement inside the case operator
Hi all
I want to write a query that get the result of another table of case operator.
for example
Select a, b, c of the double
where a = 1
and b = case when b is null then 'select any value from the other table' any other purpose;
Please help me to write this query.
Thank youSelect a, b, c of the double
where a = 1
and b = case when b is null then 'select any value from the other table' any other purpose;Guilty plea
Select a, b, c from tableA a
where a.a = 1
and a.b = (select decode (a.b, null, (select 1 from tableB b where rownum = 1), a.b) double) -
JCheckBoxMenuItem with Action aid - how to get the selected state
Hello
I have a JMenu with some JCheckBoxMenuItems. I want to use with an Action. Is it possible to get the status of the Action CheckBoxMenuItem selection?
Thanks in advance
DominikSwing only updates the Action.SELECTED_KEY property if it has been set, so when you create your action you must set this value.
myAction.putValue(Action.SELECTED_KEY, false);
-
Need to know how long takes the Select statement of the cursor?
Hi people
I want to know the duration of execution of the cursor in a stored procedure.
Piece of my code is provided below.
procedure Process_PCN_MAT_Custs)
p_PCN_OID in varchar2,
p_days_back number
) is
number of vcount;
v_newoid varchar2 (16);
date of pcn_create_date;
T_DATE: = to_char (sysdate, ' dd/mm/yyyy hh24:mi:ss');
cursor (SAP_Customers)
x_PCN_OID varchar2,
number of x_days_back
date of x_pcn_create_date
) is
Select
KUNNR,
Max (soldflag) soldflag,
Max (shipflag) shipflag,
Max (endflag) endflag,
Max (custName) custname
de)
Select / * + DRIVING_SITE (bims_pcn_shipments) * /.
KUNNR,
SoldFlag,
ShipFlag,
EndFlag,
custName
Of
bims_pcn_shipments_mview
where
material_number in (select sap_material_no from the pcn.material where pcn_oid = x_PCN_OID)
and bdr_date > (x_pcn_create_date - x_days_back)
UNION
Select / * + DRIVING_SITE (bims_pcn_shipments) * /.
KUNNR,
SoldFlag,
ShipFlag,
EndFlag,
custName
Of
bims_pcn_backlog_mview
where
material_number in (select sap_material_no from the pcn.material where pcn_oid = x_PCN_OID)
and bdr_date > (x_pcn_create_date - x_days_back)
)
Group
KUNNR;
dbms_output.put_line to_char (v_date);
Begin
Open SAP_CUSTOMERS
---
---
---
close SAP_CUSTOMERS
end
I get an error of compilation for this line [T_DATE: = to_char (sysdate, ' dd/mm/yyyy hh24:mi:ss');].
Saying "+ Error (95,12): PLS-00103: encountered the symbol"="when expected as follows: constant exception < an ID > < a double quote delimited identifier > table Fedya double Ref char time timestamp interval date binary character national nchar"< an ID >"symbol has been replaced for"="continue +.»
I would be grateful if someone can help me solve this weired compilation error.
Thank you
VineetThen you need to go to the function [DBMS_UTILITY. GET_TIME. http://download.Oracle.com/docs/CD/B19306_01/AppDev.102/b14258/d_util.htm#sthref7809].
Something like that...
n := dbms_utility.get_time;
dbms_output.put_line( (dbms_utility.get_time-n)/100) || ' seconds....' ); Published by: Karthick_Arp on January 16, 2009 05:07
-
How to block a select statement for a table of the specified until validation line
Hello
How to block a SELECT statement for a specified row in a table until willingness to engage occure?
My procedure is part of a Stock request and if a user (X) get stock 1 piece, another user must wait for the user (Y) complete his reportoire.
So, let say my stock have 10 pencils.
When the X user starts the Stock_PLS procedure, in table Stock, line (e.g. R1) that user X should work with it, must be lock up to what the commit / rollback will appear.
procedure Stock_PLS...
Start
..
pencils: pencils-1 =;
..
End
Observation-> pencils: = 9;
This means that is a user there, run SELECT * stock of the table where rows_id = R1, SELECTION should wait the Stock_PLS started by user X will be completed (with commit or rollback) and his SELECT should return the value 9.
What I need, is that Oracle has something like LINE EXCLUSIVE TABLE LOCK, but in my situation the SELECT statement should be denied on the specified lines, until the end of the procedure.
Kind regards
MichaelHello
You can achieve this using the update with the Select clause.
You can write your select statement like this
SELECT * from stock of the table where rows_id = R1 for update; -
How to get a select statement to pass a variable as the OUT parameter in PROC
I have the underside of the nested select statement that returns the name of the missing table (data_table_name).
How to be an effective way to modify the select statement, so that the returned 'data_table_name' is passed as OUTPUT in a procedure parameter
Any help is greatly appreciated.select 'Missing Table Name : ' || data_table_name from ( select upper(data_table_name) data_table_name from TABLE1 where data_table_name in ('ABC',EFG','XYZ') MINUS ( select upper(fus_data_table_name) from TABLE2 where fus_data_table_name in ('EFG',') group by upper(fus_data_table_name) union select upper(fus_data_table_name) from TABLE2 where fus_data_table_name = 'LMN' group by upper(fus_data_table_name) ));
SCREATE OR REPLACE PROCEDURE myproc (tname OUT NOCOPY VARCHAR2) AUTHID CURRENT_USER IS BEGIN SELECT something INTO tname FROM whatever; EXCEPTION WHEN OTHERS THEN tname :=
; END myproc; / -
How to convert this select statement in the update
Hai All
I have two tables namely Daily_attend, Train_mast
The Daily_attend are made up of fields are Train_mast are made up of fields are
Name varchar form no var
Date of empcode Num V_DATE
Intimate Date Train_name var
Outtime date Late_hrs var
Number IND_IN
Number IDE_OUT
Date of Attend_date
I need to update the table Depend of IDE_IN in Daily_attend in late_hrs in the Train_mast table
I got through in the select statement, it is my select statement
Select to_number (TO_DATE (TO_CHAR(Intime,'DD-MON-YYYY') |)) » '||
To_char (0815, '0000'), 'MON-DD-YYYY HH24') + late_hrs /(24*60)-respondent
) * 24 * 60 dail_Att, train_mast;
How can I convert to update
Any help is highly appricateable
Thanks in advance
Concerning
Srikkanth.MSrikkanth,
Try this code. And 1 thing, I don't see any WHERE condition to join between the 2 tables, DAIL_ATT, TRAIN_MAST.
UPDATE DAIL_ATT A SET A.IDE_IN = (SELECT TO_NUMBER(TO_DATE(TO_CHAR(INTIME, 'DD-MON-YYYY')|| ' ' || TO_CHAR(0815, '0000'), 'DD-MON-YYYY HH24:MI') + LATE_HRS / (24 * 60) - INTIME) * 24 * 60 FROM TRAIN_MAST B WHERE
); Kind regards
Manu.
If my answer or the answer to another person has been useful or appropriate, please mark accordingly
-
How to pass parameter in the function using the select statement?
Hello
I had a problem. I can't pass as parameter to the function by using the select statement. But it can pass as a parameter using the "code". How can I solve this problem?
For example,.
Select * from table (SplitFunction ('HS750020, HS750021')) < < < this work.
but
Select * from table (SplitFunction (select LOT_NO in the TRACER_SEARCH_SCHEDULE where JOB_ID = '36')) < < < do not work.
Thank you for trying to help him. Thank you.Select * from table (SplitFunction (select LOT_NO in the TRACER_SEARCH_SCHEDULE where JOB_ID = '36'))< do="" not="">
Try like this
select * from table(select splitfunction(lot_no) from tracer_search_schedule where job_id='36')
Just make sure that your subquery returns only 1 row.
-
How to use the Type of Oracle Table values in the Select statement.
Hello
I get the initial set of values in the Table of Type Records of the Oracle and want to use the list of values in the Select statement.
For example, try something like the following:
TYPE t_record () IS RENDERING
ID TABLEA.ID%type,
NO TABLEA.NO%type
);
v_record t_record;
T_table TYPE IS the v_record TABLE % TYPE;
v_table t_table;
-Code to fill the values of v_table here.
SELECT ID, NO, COLLECT in BULK IN < some other table variabes here > FROM TABLEA
WHERE ID IN (i) v_table USER.USER;
I want to know how to use the Type of Oracle Table values in the Select statement.Something like this:
create or replace type t_record as object ( id number, no number ) / CREATE or replace type t_table AS TABLE OF t_record; / set serveroutput on declare v_table t_table := t_table(); v_t1 t_table := t_table(); begin v_table.extend(1); v_table(1).ID := 1; v_table(1).No := 10; v_table.extend(1); v_table(2).ID := 2; v_table(2).ID := 20; SELEC t_record (ID,NO) BULK COLLECT INTO v_t1 from TableA FROM TABLEA WHERE ID IN (select t.ID from table(v_Table) t); for i in 1..v_t1.count loop dbms_output.put_line(v_t1(i).ID); dbms_output.put_line(v_t1(i).No); end loop; end; /
No test!
P;
Published by: bluefrog on March 5, 2010 17:08
-
How to use the variable instead of the table name in the select statement of procedure
I have a procedure with a select statement with dynamic from clause. How can I use instead of the name of the table variable.
create or replace procedure scc_chemical_analysis
is
v_table_name varchar2 (100);
Start
declare
cursor c1 is select * from v_table_name; -This is the variable name. How can I use it in the select statement.
.
.
.
.
end;Hello
something like that.
1 declare 2 vSQLString VARCHAR2(32000); 3 pTableName varchar2(1000):='EMP'; 4 BEGIN 5 vSQLSTRING := 6 'SELECT ''x'' FROM ' || DBMS_ASSERT.sql_object_name(pTableName) || ' WHERE rownum<=1 '; 7 EXECUTE IMMEDIATE vSQLSTRING; 8* END; SQL> / PL/SQL procedure successfully completed.
-
How to ask the user to type in the select statement
Hello
Can anyone tell me the syntax of the select statement where I can ask the user to enter the value.
for example, I try to use belowthing, but it displays error
Select * from emp where empname =: empname
SP2-0552: Bind "empname' undeclared variable.
2. is there a dictionary of data table to see all pl/sql procedures and corresponding code?
Thank you
SriTry:
select * from emp where empname='&empname';
L.
Maybe you are looking for
-
How can I automatically copy myself in my emails?
I use 2 computers in my company. I don't use "cloud".I want that all my emails that I send from my computer at home (MacBookPro) appears on my work computer (PC w / 8 Win).I use Thunderbird on both.
-
Satellite P100-257 enjoys High Definition Audio
Hello.Tell me please: only P100 - and my P100-257 machines have in particular - HD audio? Specifications on this site tells that his 16-bit and Toshiba Bass Enhanced Sound System with SRS TruSurround XT technology. Tells me nothing about the HD audio
-
HP Officejet 6500 has stopped printing, paper white just came out.
My Officejet 6500 has just stopped printing. I use a USB connection and my operating system is Windows XP Home Edition. At first, it was just the text that Wouln't print but the colors would come by, even on test prints. On a print document the li
-
Tried to install Diablo III. Could not. Said (Vista) Operating System to SP2. Check out my features and went to the microsoft Download Center and download the sp2. Click on it to install it... half completed and stopped. Said "installation failed." T
-
My operating system is Windows 7, 64 bit.I turn on my computer and seized about ten minutes on this subject (sometimes varies), it crashes. The screen goes black with a blue square in the middle with the incident on the subject information. It says s