How to write a class for this?
how do i write a different class for this? how do i implement the "a.add(b)"? it code is to test basic arithmetic operations.
System.out.print ("Arithmetic: enter two integer numbers: ");
Integer a = new Integer (Integer.parseInt(kbd.readLine()));
Integer b = new Integer (Integer.parseInt(kbd.readLine()));
System.out.println (a + "+" + b + "-" + b + "*" + a + "/" + a + "%" + b + " is: " + a.add(b).sub(b).mul(a).div(a).rem(b));
public class arthOperation{
add()
sub()
sub(){
mul()
mul(){
div()
div(){
rem()
rem(){
is it write?
Similar Messages
-
How to write Select statement for this codition
I need to check whether SGTXT contains BELNR value.
SGTXT is a text field and It should be matched with BELNR
How to write select statement for this.
Select AUGBL AUGDT into t_BSAD
from BSAD
where SGTXT should have the given BELNR Value.
Plz note : Here I cannot give as SGTXT = BELNR as coz BELNR have only 10 digits.Hi,
data temp(12).
concatenate '%' belnr '%' into temp.
Select AUGBL AUGDT into t_BSAD
from BSAD
where SGTXT like temp.
If belnr is having multiple values,just create a internal table as follows.
types : begin of ty,
belnr....
temp(12),
end of ty.
data itab_ type standard table of ty.
data wa type ty.
loop at itab into wa.
concatenate '%' wa-belnr '%' into wa-temp.
modify itab from wa index sy-tabix transporting temp.
endloop.
Change your select statement accordingly.
Kindly reward poits if it helps. -
How to write complex sql for this
Hi ALL,
I have a requirement like this
I have 5 tables which i have to join to get the result
but there no join column to 2 other table.
I want to get all the applications using cobal,running on UNIX.
How to write the query for this
1.APP
APP_i DESC
1 Accounts
2 Payments
3 order transfer
4 Order processing
2.Techgy
techid techdesc
1 cobal
2 Java
3.APP_Techgy
APP_I Techid
1 1
2 1
3 1
4 2
4.Pltfrm
pltfmid pltfrmdesc
1 Windows NT
2 UNIX
5.APP_Pltfrm
APP_I pltfrmid
1 1
2 1
3 2
4 2
ouput must be
APP_i Desc techDESC pltfrmdesc
3 ordertranfer Cobal UNIX
Thanks in advanceThis ('descr' in place of 'desc')?
SQL> select a.app_i, a.descr, t.techdesc, p.pltfrmdesc
from app_techgy atc,
app a,
techgy t,
app_pltfrm ap,
pltfrm p
where atc.techid = t.techid
and atc.app_i = a.app_i
and atc.app_i = ap.app_i
and ap.pltfrmid = p.pltfmid
order by a.app_i
APP_I DESCR TECHDESC PLTFRMDESC
1 accounts cobal windows nt
2 payments cobal windows nt
3 order transfer cobal unix
4 order processing java unix
4 rows selected. -
How to write a PCR for this ?
Hi SAP-HR Experts .
Dear friends , My Company Requires a specific requiremnt that at the date of any Employee's
B'day his one day salary should get doubled and he is entitled to get one leave on his B'day .
I do not know how to write a PCR for this ?
May some Body tell me how to meet this requirement Please .
tell me please step by step how to go through ...
It will be great help for me .
Best regards : rajneeeshI think you can make it with something like this:
Write a PCR in schema, you can call the rule with "actio";
000860 ACTIO 9BIR AR Birthday
Rule 9BIR
9BIR Rule for Birthday
NUM=FG C Set " F (fixed indicator for deadline calculation); G (Birth date from infotype 0002);C (complete months)
NUM/12 División " Number of completed months divided by 12
NUMV0O2L Off.Lng en arg.var. " the last two places of the number are entered in the variable argument.
" if the rest is not 00, there is nothing to do
00 " if the rest is 00
ZERO= N AmtNumRteZeit = 0 "
AMT= 1002 Set " wagetype of salary
AMT/TKDIVI División " divides the amount by Partial Period Parameter Whole Month
ADDWTI1002 Input table " accumulates into 1002
Example: an employee with birthday 01.01.1977 in IT0002
Payrroll in january 08
wagetype 1002 before rule 9BIR:
3 1002 Salario Bas01 30,33 30,00 909,90
Rule 9BIR
NUM=FG C Set; NUM= 372
NUM/12 ; 372/12= 31 rest=00
AMT=1002 ; AMT= 909,90
AMT/TKDIVI ; 909,90/31= 29,35
ADDWTI1002 ; 909,90 + 29,35= 939,25
wagetype 1002 before rule 9BIR:
3 1002 Salario Bas01 30,33 30,00 939,25
Hope this helps. Manuel -
Interactive Scripting Editor (ISE) how to write a class for an action?
Hi - I need to write a class for an action in the interactive scripting editor. The class will create a new case (case management) and return the number. I have created a class with a method that does this and has been fully tested but we cannot get it to work as part of an action within the ISE. Are there any guidelines for writing classes for the ISE. Or has anyone done this? Do I need a super class? I have searched every where but can find nothing on this. Many thanks.
Hi Nigel,
I am also looking for the answer to this. Please let me know when you find a solution.
Kind Regards,
Andrew Griffin. -
How to write select query for this
Hi,
I had a html form and in the for i had drop down box and it needs to select multiple values from the drop down box. When i select multiple values then i have to write the SQL select statement query .
When i try to write the select statement and trying to run i am getting error.
select * from Table
where emo_no = '1,2,3'
this is how i write query please suggest me how to write query for selecting multiple values from the drop down box.
Thanksselect * from Table
where emo_no in ( 1,2,3)
for integer values
select * from Table
where emo_no in ('1','2','3')
for characters
If we talk about large scale applications that may have millions of records, I would suggest this.
declare @t table (v int)
insert into t (v) values (1)
insert into t (v) valves (2)
insert into t (v) values (3)
select *
from table
inner join @t t on table.emo_no = t.v
Using "in" for a where clause is not so bad for filtering on a few values, but if you are filtering a lot of rows and a lot of values (emo_no) the performance degrades quickly for some reasons beyond the scope of this.
This is just one solution, I'll through this out as well, instead of an in memory (@t) table, doing a disk based temp table (#t) and creating an index on the column "v".
create table #t (v int)
insert into #t (v) values (1)
insert into #t (v) valves (2)
insert into #t (v) values (3)
create index ix_t on #t (v)
select *
from table
inner join #t t on table.emo_no = t.v
drop table #t
Pardon any syntax errors and careful using a drop statement.
Sometimes in memory tables work better than disk temp tables, it takes some testing and trial and error depending on your datasets to determine the best solution.
Probably too much info ;-)
Byron Mann
[email protected]
[email protected]
Software Architect
hosting.com | hostmysite.com
http://www.hostmysite.com/?utm_source=bb -
How to write a query for this output
I have a string ' if i know good acting , I am a hero '
now if 'hero' is present in the string it will return ' i am hero' else
'you are hero'
How to write a sql query to return the same .SQL> select (case
2 when '&a' like '%hero%' then 'I am hero'
3 ELSE 'u r hero'
4 end) output from dual;
Enter value for a: if i know good acting , I am a hero
old 2: when '&a' like '%hero%' then 'I am hero'
new 2: when 'if i know good acting , I am a hero ' like '%hero%' then 'I am hero'
OUTPUT
I am hero
SQL> /
Enter value for a: jkhkh
old 2: when '&a' like '%hero%' then 'I am hero'
new 2: when 'jkhkh' like '%hero%' then 'I am hero'
OUTPUT
u r hero
Hope this helps. -
How to write a query for this data??
In this table i have column dob which is DATE type,for example 12-jan-89 I want output like this
Year Day
12-jan-89 Thusrs_day
12-jan-90 Friday
upto
12-jan-14 sundaykrishnagopi wrote:
No not like that ,I want up to 2014 year
Ok, so lets say you have table like this
SQL> create table my_table(dob date);
Table created.
SQL> insert into my_table (dob) values( to_date('12-jan-1989', 'dd-mon-yyyy'));
1 row created.
SQL> commit;
Commit complete.
SQL> select * from my_table;
DOB
12-JAN-89
You can write a query like this
select dob + (level -1) dob
, to_char(dob + (level -1), 'fmDay') day_
from my_table
connect
by level <= (dob + interval '25' year) - dob + 1; -
How to write a DTD for this scenario?
hi,
consider the following xml
<set after = "A">
<item name="A" ></item>
<item name="B" ></item>
</set>
The DTD for the "item" element is
<!ATTLIST item name (A | B| C| D| E ) #REQUIRED >
The attribute "after" of "set" can hold a single valid name like
<set after = "A">
or
a collection of valid names seperated by coma like <set after = "A,B,C">
how to write DTD for the "after" attibute such that it will contain a single valid name or collection of names?
Regards,
Ajay.I could be wrong, but I'm pretty sure that DTD doesn't support that. You're probably better off declaring the name attribute to be of type PCDATA and tokenizing the value manually in code.
-
How to write Resourebundle class for uix page
Our web application should support some different languages .I have took a look of "Internationalization" by help system but still not so clear.
How to make a simple uix page supported with multiple languages at runtime ? If Resoursebundle is the answer ,how to realize it? Has anybody example codes?
thanks
YongYes, you should use a java ResourceBundle, and you can use the bundle data provider to bind text from a bundle. This is described in the Internationalization chapter of the UIX developers guide.
As to how to write a resource bundle, there should be info available on the web, so try doing a search. -
How to write SQL hints for this query?
The query is like:
select * from foo, t
where foo.name in
(select name from bar
where id in (
select id from car
where date < sysdate
and foo.a = t.b;
I want the innermostsubquery 'select id from car ...' to be executed first, and the subquery 'select name from bar ...' to be execute second, and the outermost query 'select * from foo,t ...' to be executed the last. How can I write the Oracle sql hints to force the order?
Thanks.user553560
You might be able to create a large set of hints to force the access path you want - but unless you really know what you are doing with hints, you may find that your solution is very unstable (it might be luck rather than correctness that let's it work to start with).
The difficulty in this query is the double layer of IN subqueries, so if you can rewrite the query, you might try manually unnesting as follows:
select
t1.*. t.*
from
select
distinct t2.name
from t2
where t2.id in (
select t3.id
from t3
where t3.dated < sysdate
) v,
t1,
t
where
t1.name = v.name
and t1.a = t.bDepending on your indexing and statistics, you may find that a simple /*+ unnest */ hint in the first subquery will be sufficient to do this for your. Again depending on the statistics you may find that you have to put extra hints into the above to make Oracle use the join method and indexes you think appropriate.
N.B. The first step (as others have noted) is to check that your statistics are good before you start manipulating the code or using hints.
Regards
Jonathan Lewis
http://jonathanlewis.wordpress.com
http://www.jlcomp.demon.co.uk -
How to write a query for this situation
Hi ,
Can any one help me to write a query.I have a table with three columns like char_id_1,char_id_2,char_id_3,these data have to insert into some other table but in the target table the data should be comma seperated like (10,8,2),here blank space indicates null.In source table the columns are numbers,but in target table it is varchar2.
source table:
CHAR_ID_1 CHAR_ID_2 CHAR_ID_3
10 8 2
7 1 5
4 11
6 1
2 8
6 12 7
Target table:
CHAR_IDS
10,8,2
7,1,5
4,11
6,1
2,8
6,12,7I started doing it to_char way, and thought of some different version, and ended up with an ugly solution which works only if you have three columns. Thought of not posting, but posting it anyway:
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
SQL> with t as(
2 select 10 c1,8 c2,2 c3 from dual union all
3 select 7,1,5 from dual union all
4 select 4,null,11 from dual union all
5 select null,6,1 from dual union all
6 select 2,8,null from dual union all
7 select null,8,null from dual union all
8 select null,null,10 from dual union all
9 select 2,null,null from dual union all
10 select null,null,null from dual union all
11 select 6,12,7 from dual )
12 --
13 select nvl2(c1,
14 c1 || nvl2(c2,',' || c2 || nvl2(c3,',' || c3,null),nvl2(c3,',' || c3,null)),
15 nvl2(c2, c2 || nvl2(c3,','|| c3,null),nvl2(c3,c3,null))) col_concat
16 from t;
COL_CONCAT
10,8,2
7,1,5
4,11
6,1
2,8
8
10
2
6,12,7
10 rows selected.
SQL> -
I have 2 tables
emp_master (emp_id, emp_name)
dept_master (dept_id, dept_name, emp_id (references emp_id in emp_master)Now there are 30 departments and each department can have maximum 5 employees.
Now I want a query that would list a department and all its employees in one line and if there are less than 5 employees it would show null for the rest of columns.
Dept_id emp_1 emp_2 emp_3 emp_4 emp_5
1 1 2 -- -- --
2 3 4 5 6 7
3 8 -- -- -- --
Please help me out
Thanks...One solution may be
Connected to Oracle Database 10g Express Edition Release 10.2.0.1.0
Connected as hr
SQL>
SQL> SELECT e.department_id, e.employee_id
2 FROM employees e
3 WHERE e.department_id IN (10, 20, 40, 60, 90)
4 /
DEPARTMENT_ID EMPLOYEE_ID
90 100
90 101
90 102
60 103
60 104
60 105
60 106
60 107
10 200
20 201
20 202
40 203
12 rows selected
SQL>
SQL> SELECT ee.department_id, ee.emp_1, ee.emp_2, ee.emp_3, ee.emp_4, ee.emp_5
2 FROM (SELECT MAX(CASE
3 WHEN MOD(r, 5) = 1 THEN
4 e.employee_id
5 ELSE
6 NULL
7 END) emp_1,
8 MAX(CASE
9 WHEN MOD(r, 5) = 2 THEN
10 e.employee_id
11 ELSE
12 NULL
13 END) emp_2,
14 MAX(CASE
15 WHEN MOD(r, 5) = 3 THEN
16 e.employee_id
17 ELSE
18 NULL
19 END) emp_3,
20 MAX(CASE
21 WHEN MOD(r, 5) = 4 THEN
22 e.employee_id
23 ELSE
24 NULL
25 END) emp_4,
26 MAX(CASE
27 WHEN MOD(r, 5) = 0 THEN
28 e.employee_id
29 ELSE
30 NULL
31 END) emp_5,
32 e.department_id
33 FROM (SELECT row_number() over(PARTITION BY department_id ORDER BY employee_id) r,
34 department_id,
35 employee_id
36 FROM employees
37 WHERE department_id IN (10, 20, 40, 60, 90)) e
38 GROUP BY e.department_id) ee
39 /
DEPARTMENT_ID EMP_1 EMP_2 EMP_3 EMP_4 EMP_5
10 200
20 201 202
40 203
60 103 104 105 106 107
90 100 101 102
SQL> Regards... -
How to write Dynamic SQL for this SQL ?
EXECUTE IMMEDIATE 'select COUNT(*) from dba_Tab_privs@' ||db_link|| ' WHERE Grantee <> 'DELETE_CATALOG_ROLE'
AND Table_Name = 'LINK$'
AND Grantee NOT IN (SELECT Grantee
FROM dba_Role_privs
WHERE Granted_Role = 'DBA')' into i using x;Hi bapalu,
I take that x is the name of your db_link?
If so,
DECLARE
i NUMBER;
x dba_db_links.db_link%TYPE;
stmt VARCHAR2(255);
BEGIN
x := 'some_link';
stmt :=
'SELECT count(*)
FROM dba_tab_privs@:db_link
WHERE grantee <> ''DELETE_CATALOG_ROLE''
AND table_name = ''LINK$''
AND grantee NOT IN(SELECT grantee
FROM dba_role_privs
WHERE granted_role = ''DBA'')';
EXECUTE IMMEDIATE REPLACE(stmt, ':db_link', x)
INTO i;
dbms_output.put_line('The count: ' || i);
END;Also, I think this is maybe not what you want:
AND table_name = ''LINK$''Regards
Peter -
How to write sql query for counting pairs from below table??
Below is my SQL table structure.
user_id | Name | join_side | left_leg | right_leg | Parent_id
100001 Tinku Left 100002 100003 0
100002 Harish Left 100004 100005 100001
100003 Gorav Right 100006 100007 100001
100004 Prince Left 100008 NULL 100002
100005 Ajay Right NULL NULL 100002
100006 Simran Left NULL NULL 100003
100007 Raman Right NULL NULL 100003
100008 Vijay Left NULL NULL 100004
It is a binary table structure.. Every user has to add two per id under him, one is left_leg and second is right_leg... Parent_id is under which user current user is added.. Hope you will be understand..
I have to write sql query for counting pairs under id "100001". i know there will be important role of parent_id for counting pairs. * what is pair( suppose if any user contains both left_leg and right_leg id, then it is called pair.)
I know there are three pairs under id "100001" :-
1. 100002 and 100003
2. 100004 and 100005
3. 100006 and 100007
100008 will not be counted as pair because it does not have right leg..
But i dont know how to write sql query for this... Any help will be appreciated... This is my college project... And tommorow is the last date of submission.... Hope anyone will help me...
Suppose i have to count pair for id '100002'. Then there is only one pair under id '100002'. i.e 100004 and 100005Sounds like this to me
DECLARE @ID int
SET @ID = 100001--your passed value
SELECT left_leg,right_leg
FROM table
WHERE (user_id = @ID
OR parent_id = @ID)
AND left_leg IS NOT NULL
AND right_leg IS NOT NULL
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs
Maybe you are looking for
-
Help, MBP Hard Drive is Read-Only, Can't access or unlock any user preferences
I could really use some help. I have searched and tried what I could but I am at a loss with what to do. I first noticed this last night when I was trying to switch users and after entering the correct password nothing would happen. I then went to Pr
-
Office Mac Compatibility With Lion
I'm trying to decide iWork vs Office for school and I have decided I need Office so the file will look the same for someone else. I was wondering if Office supported autosave and other lion features. Also I was wondering if anyone thinks iWork will w
-
How can I turn this line and its intersection into a separate object?
My initial object is #1, then I draw a line on #2. How can I turn the highlighted area into a separate object? (I cheated and filled this area with Photoshop, but I'd like to know how to turn this red area into a separate object so that I can fill it
-
I am using test stand and Labview 7.1. I used Express VIs to setup my RS232 communications in numerous VIs that I call from test stand for different types of tests. I have the same product, but with different baud rates. Is there a way in test sta
-
I have tried repairing or deleting it from the control panel, and with the CD. I am getting error code 1321. Can you help please.