How to find the largest odd number and smallest even number from an array
Hello All
I want to find out largest odd number and the smallest even number from an arry numbers? What is the best method to achieve this.
Thanks
Sravz
You need to sit down and figure out an algo on how you would do it if you had to do the same thing from a blind container perspective:
1 - collect all the items you want to look at
2 - look at an item
3 - is it odd?
4 - if it is odd then check if it is larger than previously largest number
5 - save it if it is larger
6 - return back to 2 unless no more items
7 - item is not odd so it must be even--is it smaller than previous
8 - save it if it is smaller
9 - return back to 2 unless no more items
Now you just need to know how to check if something is even or odd: to do this you will need the modulous operator--integer division.
Note: this all assumes that your needs are for integer type of numbers, otherwise there is not enough information to define an answer. For instance, if you are using floats at 0.5--it that even or odd? Do you consider an err factor when dealing with floats? etc...
Similar Messages
-
How to find the Last modified date and time of a package
Hi,
We need a clarification on how to find the Last modified date and time of a package in Oracle. We used the example below to explain our scenario,
Lets consider the following example
Let A, B be two packages.
Package A calls the package B. So A is dependent on B.
When A is compiled the TIMESTAMP,LAST_DDL_TIME in USER_OBJECTS gets updated.
Now there a modification in package B so it is compiled. There is no modification in package A.
Now when the package A is executed the TIMESTAMP,LAST_DDL_TIME in USER_OBJECTS gets updated but we did not make any change in Package A. Now we need to find last modified date and time of the package A . So we can not rely on the TIMESTAMP,LAST_DDL_TIME in USER_OBJECTS . Can u please tell us any other solution to get last modified date and time of the package A .
Regards,
Vijayanand.CHere is an example:
SQL> SELECT OBJECT_NAME,CREATED,LAST_DDL_TIME,TIMESTAMP,STATUS FROM USER_OBJECTS
2 WHERE OBJECT_NAME = ANY('A','B');
OBJECT_NAM CREATED LAST_DDL_TIME TIMESTAMP STATUS
A 20-MAY-2004 10:57:32 20-MAY-2004 10:57:32 2004-05-20:10:57:32 VALID
B 20-MAY-2004 10:58:22 20-MAY-2004 10:59:04 2004-05-20:10:59:04 VALID
SQL> CREATE OR REPLACE PROCEDURE A AS
2 BEGIN
3 NULL;
4 NULL;
5 END;
6 /
Procedure created.
SQL> SELECT OBJECT_NAME,CREATED,LAST_DDL_TIME,TIMESTAMP,STATUS FROM USER_OBJECTS
2 WHERE OBJECT_NAME = ANY('A','B');
OBJECT_NAM CREATED LAST_DDL_TIME TIMESTAMP STATUS
A 20-MAY-2004 10:57:32 20-MAY-2004 11:01:28 2004-05-20:11:01:28 VALID
B 20-MAY-2004 10:58:22 20-MAY-2004 10:59:04 2004-05-20:10:59:04 INVALID
SQL> EXEC B
PL/SQL procedure successfully completed.
SQL> SELECT OBJECT_NAME,CREATED,LAST_DDL_TIME,TIMESTAMP,STATUS FROM USER_OBJECTS
2 WHERE OBJECT_NAME = ANY('A','B');
OBJECT_NAM CREATED LAST_DDL_TIME TIMESTAMP STATUS
A 20-MAY-2004 10:57:32 20-MAY-2004 11:01:28 2004-05-20:11:01:28 VALID
B 20-MAY-2004 10:58:22 20-MAY-2004 11:01:53 2004-05-20:11:01:53 VALID
Note that the date under the column 'created' only changes when you really create or replace the procedure.
Hence you can use the column 'created' of 'user_objects'. -
Hi, could someone tell me how to find the relation between PAY_ELEMENT_TYPES_F and GL_CODE_COMBINATION tables
that is because as you could know PAY_ELEMENT_TYPES_F holds the definitions of elements in Oracle HRMS and i need to find the accounting code of each element.
ThanksHi;
Please check e-trm site for table relation,integration,explanation etc..
etrm.oracle.com/
Regard
Helios -
How to find the max session count and process count for a database
Hi All,
How to find the maximum session count and process count reached for a database over a period of 15 days?
DB version:11.2.0.2
OS:AIXThanks for the link.
The output of the below query that is given in the link shows the results for the last 10 or 12 days.. Is there a query which gives a result for the last 30 days?
col metric_unit for a30
set pagesize 100
Select trunc(end_time),max(maxval) as Maximum_Value,metric_unit
from dba_hist_sysmetric_summary
where metric_id in ( 2118,2119) group by trunc(end_time),metric_unit order by 1; -
How to find the compoment version information given a PPMS number?
Hi,
<b>Problem</b>:
I want to find the component version information with a PPMS number; and would like to know how to.
(I don't know which forum is exactly proper to post this thread, and then put it in NetWeaver Platform category.)
<b>Details</b>:
In ERP system, transaction BOPP (PPMS work center), you can find product/component (version) information, including their PPMS number.
While I didn't find the way to retrieve the component version and other information, given a PPMS number.
Is this possible in BOPP? Or there is other ways to do this?
Thanks and regards,
Saiduser651567 wrote:
Hi,
Through putty we can access the unix server which is the Databse server.So i need the ip and port number to connect.Why don't you just walk down the hall and ask your friendly SA? Or if he's not in the same building, pick up the phone.
I'm increasingly aware of a sub-culture that is afraid or unwilling to actually talk to their co-workers to find out information that is unique to their organization .... -
How to find the link between strcture and query technical name
Hi Guru's
How to find the link between Strcture in the query and query technical name. In other way where used list of the structure used in queries?
I know we have table called RSZELTDIR which have the values of strcuture name. from here i do not find any link to query technical name.
Please can anyone help me?
Regards,
SirishaHi ,
For structure and query relationship, the structure has to be a reusable structure( a global one). Then you can right click in on the structure name (in BEX query designer) and select the where used list. You will find all the query names where it is being used.
U can also check out tables RSRREPDIR and RSZCOMPDIR for other query properties.
Thanks,
Amit -
How to find the largest files?
My question is how to find the big(lets say over 500Mb) files under the root and list them.
This is my desktop and when I tried "du / | sort -k 1n " it didnt finish.
Best regards,
TongucThank you for your interest Mr.Kartik.
[root@tcellhost /]# find / -size +500M
find: invalid -size type `M'
[root@tcellhost /]# find / -size +500m
find: invalid -size type `m'
[root@tcellhost /]# find / -size +500000
/u01/app/oracle/flash_recovery_area/TCELL/backupset/2007_04_12/o1_mf_nnndf_TAG20070412T091708_31vmq4z4_.bkp
/u01/app/oracle/flash_recovery_area/TCELL/backupset/2007_04_12/o1_mf_nnndf_TAG20070412T091708_31vmq5xr_.bkp
/u01/app/oracle/oradata/tcell/users01.dbf
/u01/app/oracle/oradata/tcell/system01.dbf
/u01/app/oracle/oradata/tcell/undotbs01.dbf
/u01/app/oracle/oradata/tcell/sysaux01.dbf
/proc/kcore
find: /proc/31477/task/31477/fd/4: No such file or directory
/oracle/10201_database_linux32.zip
/oracle/GridControl_10.2.0.3_Linux.zip
/oracle/10201_companion_linux32.zip
How can I execute a list command for the resturning file set?
[root@tcellhost /]# find / -size +500000 -exec ls -lt {};
find: missing argument to `-exec'
Best regards,
Tonguc -
How to find the system default scripts and prompts in UCCX 8.0
Hello everyone,
I have a bit of experience in UCCX 6.0 and just began to use UCCX 8.0. There's a question that where can I find the system default scripts and prompts in 8.0? In 6.0, I can find them in installing directory, but 8.0 is linux based so I can not do that in same way.
Thanks.You can Login to CLI with either root access or remote user access and get default scripts by going to
CD /opt/cisco/uccx/Scripts/system/default
At this point you have to connect to ftp server and move these default script to yoru FTP server.
I hope this helps -
How to find the version of AIA and PIP
Is there any way, where in we can find the version of AIA and PIP installed on a server ?
thanksOption 1 : From AIA 2.4, navigate to AIA console (http://<host:port>/AIA), go to the Setup tab and view the version.
In the upper right hand corner of the AIA console, there is an "About AIA" link which will show you the AIA FP and PIP version numbers.
Option 2
You can find the PIP version details under AIAHOME(PIP Install home directory)/config/deploy.properties file. -
How to find the largest tables in EBS
Hi gurus,
Oracle EBS R12.1.2
Linux x86-64
RDBMS 11g
How can I find the top 10 largest tables in EBS - in terms of size (KB/MB)? pls send me the Query and also direction from where (which Schema) should I run that query?
-- TIAHi;
I suggest check below threads:
How to know which is the largest table in my oracle database??
Find Largest Tables in 9i Database
Query to find biggest table in oracle ERP database?
Those links should give you answer of your questions.
Regard
Helios -
How to find the premise GUID to a given premise number in CRM
Hi Guys,
I try to find the PremiseGUID (VerbrSt.GUID) to a given Premise Number (Verbrauchsstellen-Nr. in German), either in IS-U (6.0) or in CRM (2007).
I need it as a foreign key in CRM table ISU_POD to connect the PoD with the Premise (field is named u201CFF0047u201D or u201CVerbrSt.GUIDu201D in table ISU_POD).
I think it should be a 22 dec. alphanum. field, corresponding to the 10 dec. num. field of the premise number.
Any suggestions in which table(s) I can find the PremiseGUID?
Thank you very much.
ChristianHi Anji,
The view VIAUF_AFVC is for maintenance orders and operations. I tried giving my functional location on the selection screen and checked for the contents , but it says no entries found. Probably this table will get populated only when a maintenance order is issued.
I need to find out the equipments at a given functional location . Is there any other way ?
regards,
Venkatesh. -
How to find the file by name and identify its type?
Hi,
In a folder thare are many files, the file types are doc, docx, pdf, and rtf. The file name is something like "FirstName LastName(more extrat letters).filetype".
Now I would like to find all the files with a certain name and identify their types. For example, by input "Bill Gates", I would get the list of all files :
Bill Gates.doc, Bill Gates-2010.pdf etc ...
Any good ideas are welcome.
PengyouFor finding files whose names match a certain pattern, create a FileFilter or FilenameFilter that returns true when the name matches the pattern in question, and then call list() or listFiles() with that filter.
For identifying the "type", that depends what you mean. File's don't actually have a type. It's just that they're interpreted as such in some contexts. The simplest thing is to just look at the extension. You can be more sophisticated than that, but that gets complicated real fast. It depends what you're actually trying to accomplish. -
How to find the largest and the widest tables in Oracle 10g ?
Hi Folks,
Environment: 10g Rel 2
Can somebody please suggest the data dictionary view(s) that I can query to get a list of the longest (rows) and the widest (columns) tables in any schema ?
Thanks in advance
rogers42rogers42 wrote:
Hi,
Thanks for the replies.
By the "longest" table, I had meant a table with most number of rows. And few people had wisely pointed out the dba_tables view.
By the "widest table", I had meant a table with the most number of columns. Is there a view that can give me this info ?
Thanks
rogers42if your statistics are updated :
SELECT D.OWNER , D.TABLE_NAME
FROM DBA_TABLES D
WHERE D.OWNER NOT IN ('SYSTEM', 'SYS')
ORDER BY D.NUM_ROWS DESC
and try this code, for the second :)
DECLARE
CURSOR cur_tab
IS
SELECT D.OWNER AS OWNER , D.TABLE_NAME AS TABLE_NAME
FROM DBA_TABLES D
W_TABLE VARCHAR2(30);
W_OWNER VARCHAR2(30);
w_count_col NUMBER;
w_col_max NUMBER;
BEGIN
w_count_col := 1;
w_col_max := 1;
W_TABLE := 'TEST';
W_OWNER := 'TEST';
FOR c IN cur_tab LOOP
SELECT COUNT(*) INTO w_count_col
FROM DBA_TAB_COLS t
WHERE t.owner = c.OWNER
AND t.TABLE_NAME = c.TABLE_NAME
IF w_count_col >= w_col_max THEN
w_col_max := w_count_col;
W_TABLE := c.TABLE_NAME;
W_OWNER := c.OWNER ;
END IF;
END LOOP;
dbms_output.put_line(' w_col_max : '||w_col_max) ;
dbms_output.put_line(' W_TABLE: '||W_TABLE) ;
dbms_output.put_line('W_OWNER : '||W_OWNER) ;
END; -
How to find the Data Entered Date and User Name?
Dear Team,
An End User feeds a data wrongly in KP26. I would like to find by whom it was entered and when? i.e, user name and Date of particular entry.
Regards
R.Thillai govindrajanHi Thillai,
I don't think you can find that information now. If you have switched on trace on that user before he changes, you would have got those details in trace file.
Thanks,
Siva Kumar -
How to find the logins,program name and databases for a session id?
I used the following the following query.
select pr.spid ,pr.dbid,pr.program_name,pr.loginame,ss.session_id,ss.host_name,ss.login_time,db.name from master.dbo.sysprocesses pr,sys.dm_exec_sessions ss,sys.databases db
where pr.spid = ss.session_id and pr.dbid = db.database_id
order by ss.login_time desc
Is spid in master.dbo.sysprocesses the same as session_id in sys.dm_exec_sessions and dbid in master.dbo.sysprocesses the same as database_id in sys.databases?
My intention is to get the active sessions with the program name,login Name and database name corresponding to the session?1)Why you included the clause session_id > 50?
Sessions with session_id <= 50 are system processes.
2)Is there any problem with the query I used?
You query was better than Latheesh's. To wit, his query will only show the database for sessions who are actually running something.
On SQL 2005 and SQL 2008, this is the best solution:
SELECT des.session_id, des.[status], des.login_name,
d.name AS database_name, des.program_name
FROM sys.dm_exec_sessions des
JOIN sys.sysprocesses p ON des.session_id = p.spid
LEFT JOIN sys.databases d ON p.dbid = d.database_id
WHERE des.session_id > 50
AND p.ecid =0
ORDER BY des.session_id;
The condition p.ecid = 0 is needed to weed out extra rows when there are parallism in force.
On SQL 2012, you don't need sysprocesses, but this works:
SELECT des.session_id, des.[status], des.login_name,
d.name AS database_name, des.program_name
FROM sys.dm_exec_sessions des
LEFT JOIN sys.databases d ON des.database_id = d.database_id
WHERE des.session_id > 50
ORDER BY des.session_id;
Erland Sommarskog, SQL Server MVP, [email protected]
Maybe you are looking for
-
AQ & Message Bean in OC4J 9.0.2
Despite all the confusion, I finally got 9.0.2 to work with AQ in a 8.1.7 database. Some of the standard JMS features are not supported by 9.0.2, but in my case I get what I needed: publish a msg using a standalone java class and receive it from a MD
-
IPhoto 9.4 crashes on export
iPhoto 9.4 crashes on export
-
Set different default values for table built using subforms
I'm using Designer 7.1 and need to have tables with a fixed number of rows, where the first column is readonly and displays a set of distinct values. For example Body System Normal Abnormal Comments Head Neck Respiratory etc. I'm constrained to build
-
Hi BlueOne, we a have baseless rumor here at our department that says the maximum step size is 6000. I have just done a 2PowerX Copy paste with the statment type. I have stopped pasting after 8192 steps inside the sequnce and let it run. Works - perf
-
I have installed Parallels 6 and Windows 7 on my MacBook Pro running Snow Leopard. I am having trouble loading MS Office 2007. I purchased a downloadable copy. But when I try to download it using IE in my Windows environment, it asks me to select a l