SQL & PL/SQL :: How To Calculate Highest Common Factor

Oct 5, 2005

Is there any function avaialble in SQL that can return the highest common factor among a bunch of numbers. For example
10,20,25 have a highest common factor of 5.

View 9 Replies


ADVERTISEMENT

Reduced Clustering Factor A Table

May 8, 2013

i reduced the clustering factor a table having 50 rows from 38 to 6 and after sometime 1000 datas are inserted into this table if it affects the retrieval speed and also advice whether the datas will be stored in the above format as compact or datas are stored in the data block based on the index/ constraints.

View 1 Replies View Related

Performance Tuning :: Clustering Factor In Index?

Dec 15, 2010

I am just curious to know what is clustering factor in index and How is it impartant in a sql tuning perspective ?

View 3 Replies View Related

SQL & PL/SQL :: Highest Value?

Feb 24, 2010

I have an table named as rawdata.I need output comes

F_DATE MAGNITUDE
--------- ----------
11-JAN-10 9

create table rawdata(f_date date,magnitude number);
select * from rawdata;

F_DATE MAGNITUDE
--------- ----------
10-JUN-09 6
10-DEC-09 6
11-JAN-10 7
11-JAN-10 8
11-JAN-10 9

View 5 Replies View Related

SQL & PL/SQL :: Highest Value In Column

Jun 21, 2011

I have a column.

EMPNO
----------
E123
E256
E420
E1420

I need to get the highest value among these. how to get it?

View 15 Replies View Related

Find Nth Highest Salary?

Jul 18, 2011

How does the following underlined query works to find the nth highest salary

SELECT DISTINCT(A.SALARY) FROM EMPLOYEE A
WHERE &SALARY = (SELECT COUNT(DISTINCT(B.SALARY)) FROM EMPLOYEE B
WHERE A.SALARY<=B.SALARY);

View 3 Replies View Related

Select Row With Highest Version

Aug 25, 2010

My table holds info on documents:

|doc_id|auth|version|date_created|

so what I'm trying to do is select the latest version of each document record.

so say I have there records:

doc_uid|doc_id|auth|version|date_created|
|1 | 100 |al |0.1 |11/4/08 |
|1 | 101 |al |0.2 |11/4/08 |
|2 | 102 |al |0.4 |11/4/08 |

So i want to select only one copy of every doc_uid(unique id) with the highest version number, which would make my output:

doc_uid|doc_id|auth|version|date_created|
|1 | 101 |al |0.2 |11/4/08 |
|2 | 102 |al |0.4 |11/4/08 |

doc_id 100 was excluded because it has a higher version which was shown instead.

So how would i express this is oracle sql.

edit: Just thought i should say that I have been tring to crack this for 2 days now :P I have been messing around with MAX() but I cant make it do what i want.

View 6 Replies View Related

SQL & PL/SQL :: Getting Highest Value From Varchar Column

Feb 12, 2011

I've a large table on which I applying aggregate and group by functions to the the results.

Here are two of the columns in my table:

Name ==== Score
John ==== 200*
Zohaib ==== 299
Ali ==== 0*
John ==== 200
Maria ==== 150*
Ali ==== 0
Maria ==== absent
John ==== absent

Here astrick (*) means with distinction....

The "score" column is a varchar column I want to run a query on this table to show the highest score for each student and the output should be like this:

Name ==== Score
Zohaib ==== 299
John ==== 200*
Maria ==== 150*
Ali ==== 0*

Important note:

1. if there is a tie between two highest scores like for a student, incase of john 200 was made twice, but the score with asterick (*) will be the "maximum" becuase it is with distinction so the output should also show the the highest score with asterick.

2. the output should show the the 2nd column (score) in desc order of highest score by each student...again incase of a tie, the one with astrick will come first in the result..

I know with just mere numbers, that is pretty easy but in this case it is a varchar column and also i need the astrick along with the highest score.

I want the simplest and shortest query if possible to achieve this result

I hope I've been able to clearly explain my requirment. I am using 10G.

View 1 Replies View Related

SQL & PL/SQL :: How To Find The Nth Highest Salary

Jun 30, 2010

how to find the nth highest salary

View 11 Replies View Related

SQL & PL/SQL :: Getting Most Common Value

Mar 31, 2010

I am using this query:

Select
t1.col1 as A,
t2.col1 as B,
t3.col1 as C,
t4.col1 as D

[Code]...

with this above query i am getting result like this:

A B C D

2 null 2 null
6 6 null 6
8 null null null

However i need the result like this:

A B C D

6 6 null 6

Note:

I am looking for common value that presents in most of these 4 tables for different t1.col2 values like 'E','G','K',...etc. I cant use the NOT NULL condition in the where clause,since i need to check for different values in t1.col2,for each of this there may be null value in any of the 4 tables.

View 3 Replies View Related

SQL & PL/SQL :: How To Get 2nd Highest Salary From Employee Table

Apr 29, 2011

i was given a task to find the second highest employee sal from emp table.

View 5 Replies View Related

Queries Will Fetch Second Highest Sal From Emp Table

Jan 19, 2012

go through both the given queries...

SELECT * FROM EMP A WHERE 1=(SELECT COUNT(DISTINCT(SAL)) FROM EMP B WHERE B.SAL>A.SAL);
SELECT * FROM EMP WHERE SAL=(SELECT MIN(SAL) FROM (SELECT DISTINCT(SAL) FROM EMP ORDER BY SAL DESC) WHERE ROWNUM<=2);

both queries will fetch second highest sal from emp table.which sorting is used by oracle in order by and group by clause.

View 1 Replies View Related

SQL & PL/SQL :: How To Get Common Records

Feb 10, 2013

I have a situation as follows.

Table1 has 10 columns as col1,col2,col3,col4,...col10

Table2 has 5 columns as col1,col2,...col5.

col3 and col4 are common in both tables.I am trying to get common records from both tables.How can I get them.

View 3 Replies View Related

Updating Rows To Highest Security Level Of Missions Of Same Type

Jan 25, 2009

I am trying to update the security_level of a mission to the highest security level of missions of the same type.

Attributes of the missions table:

mission_id, code_name, mission_type_id, mission_date, security_level

The following is an intermediate output.

MISSION_ID MISSION_TYPE_ID SECURITY_LEVEL
318 3 6
329 3 2
286 5 6
521 5 3
281 6 4
396 7 3
331 8 4
14 9 4
230 9 0
486 10 2

The maximum output for each mission_type_id

MAX_LEVEL TYPE
6 3
6 5
4 6
3 7
4 8
4 9
2 10

According to this 3 records (329,521 and 230) should update.

But my code returns an error.
ERROR at line 4:
cannot update (......"SECURITY_LEVEL") to NULL

this is my code

UPDATE
AM_X_442_2 amx
SET
Amx.SECURITY_LEVEL =
(
select
max_level
[code].........

I have intended the query to make it legible but it removes all spaces.

View 8 Replies View Related

SQL & PL/SQL :: How To Use Common Group By Function While Using Union All

Aug 12, 2010

i am having two sql query which i have made union of it but i need group by common.

select
distinct ac.CUSTOMER_NAME cust_name,
ac.CUSTOMER_NUMBER cust_no,
ps.CUSTOMER_SITE_USE_ID,
raa_ship_ps.PARTY_SITE_NAME loc,
sum(days_30.AMOUNT_DUE_REMAINING) D_30,

[code]........

View 9 Replies View Related

SQL & PL/SQL :: Grouping List Of Elements With One Or More Common?

Oct 6, 2011

I have a one column table that store lists of elements :

create table test_table (c1 VARCHAR2(4000));
insert into test_table values ('1,23');
insert into test_table values ('1,2');
insert into test_table values ('3,4,5');

[code]...

The output column would be something like that:

output_column
1,2,7,23
6,9,0
3,4,5

I'm grouping columns that have at least one element in common.

(1,23) and (1,2) merge into : (1,2,23)
(1,2,23) and (7,2) merge into : (1,2,7,23) --> Output
(6,9) and (9,0) merge into : (6,9,0) --> Output
(3,4,5) and (5,5) merge into : (3,5,5) --> Output

I have made this logic using only PL/SQL, with loops and nested tables using function memberof, but I suppose that there is a way to improve the performance using only SQL.

View 9 Replies View Related

Forms :: Host Common On Linux

Oct 27, 2010

My database as well as application on linux. I want to execute this command on linux. I need equivalent code.

host('cmd /c E:data empITC1'.bat');

code of ITC1.bat is
echo off
sqlldr userid=user_name/pass@database control=E:data empITC1.ctl log=E:data emplogITC1.log

echo ........

control file as well as bat file exist in respective folders.

View 9 Replies View Related

Data Guard :: What Is The Most Common Mode

Feb 27, 2012

what is the most common mode in dataguard? maximize protection or maximize availability or maximize performance

View 6 Replies View Related

PL/SQL :: Find Common And Internal Calls?

Jul 19, 2013

create table call(id number(15) primary key, calling_no varchar2(15), called_no varchar2(15), calldate date, calltime timestamp, duration number(10) ,calltype varchar2(10));  1. CALL DETAILS OF 9891826547insert into call (id,calling_no,called_no,calldate,calltime,duration,calltype) values (1, 9891826547, 9891210785, to_date('01-Jun-13','dd-Mon-yy'), to_date('19:12:00','hh24:mi:ss'),10,'OUT'); insert into call (id,calling_no,called_no,calldate,calltime,duration,calltype) values (2,9891826547, 9899985476, to_date('01-Jun-13','dd-Mon-yy'), to_date('22:10:12','hh24:mi:ss'),50,'OUT'); insert into call (id,calling_no,called_no,calldate,calltime,duration,calltype) values (3, 9891826547, 9818415767, to_date('02-Jun-13','dd-

[code]...

View 3 Replies View Related

Reports & Discoverer :: MATRIX Report / Bold Value With Highest Value In Numeric Field?

Nov 11, 2010

I want to Bold the value with highest value in Numeric field. how can i do this.

View 12 Replies View Related

PL/SQL :: Find Common Data In 2 Columns In Two Different Tables

Oct 22, 2012

query to find out common data from 2 columns in two different tables??

View 6 Replies View Related

74 Privileges From Different Users On Different Tables To One Common User?

May 20, 2013

i have to give 74 privileges from different users on different tables to one common user,how can i do this?

View 7 Replies View Related

SQL & PL/SQL :: Oracle 11g / Windows 8 - Common Code In Package

Sep 13, 2013

In oracle 11g windows8 - OS

Suppose, there is a package p1 with proc A, Proc B and Func C.Now when any of the package proc or func gets invoked from a stored proc G then a common code which reads the cols of table xyz should be executed. How to do that?

View 8 Replies View Related

PL/SQL :: Compare Two Tables And Delete The Common Rows From Table 1

Jul 23, 2012

I want to compare two tables , and delete the common rows from the first table

Here is what i have done :

Create table test1(Test1C1 Number,
Test1C2 varchar2(50));

Create table test2(Test2C1 Number,
Test2C2 varchar2(50));

Insert into test1 values(1,'testdata1');
Insert into test1 values(2,'testdata2');
Insert into test1 values(3,'testdata3');
[code].......

it deletes all the records from Table test1. What should I modify here ? or should I write a different query ?

The desired contents in table test1 will be

2 testdata2
4 testdata4
6 testdata6
8 testdata8
10 testdata10

View 5 Replies View Related

Application Express :: How To Validate In Common PL/SQL Package And Show Custom Messages

Feb 11, 2013

Currently if i let required field empty, then APEX puts systematic error message "XXX must have some value." near the field and into the page header. I want to create custom business rule, that would show message for example "This action cannot be performed, because this and that...".

That kind of custom validation should be in my plSql package and somehow it should throw/send the phrase "This action cannot be performed, because this and that..." to the page header where was message "XXX must have some value.".

How can i create such custom error message to appear out using PlSql package function that i define myself? I plan to create a common validation package, which has lots of plsql functions to validate lot of APEX pages/forms, all those functions should throw/send somehow error messages to page header. I looked that this unofficial solution does not suit for me:

[URL].......

Because it disables APEX systematic automatic validations as i understand, and is unofficial.

View 4 Replies View Related

Forms :: PDE-PLI011 A Tools Common Schema Table Missing From Object Store

May 26, 2011

while trying to open an exisitng Form, an Error message appears as:

PDE-PLI011 A tools common schema table is missing from the object store.

and failed to open. what's the problem ? what i have to do ? it was working fine before.

View 2 Replies View Related

Calculate On Itself

Jun 3, 2011

only one table A(autoid, number)

how SELECT statment result: B(autoid, number, numberB)

numberB is sum of all the number have autoid > its autoid.

View 4 Replies View Related

SQL & PL/SQL :: Package To Calculate Pay

Oct 20, 2010

Trying to accomplish:

I am trying to calculate pay with a package which consists of four functions for calculations and a procedure that calls the functions to calculate net pay.

DML DDL and package

I the DML and DDL and the package as an attachment.

Problem

Errors below

32/9 PLS-00103: Encountered the symbol "E" when expecting one of the following:

, ; for group having intersect minus order start union where connect The symbol "having" was substituted for "E" to continue.

32/54 PLS-00103: Encountered the symbol ")" when expecting one of the following:

LINE/COL ERROR
-------- ----------------------------------------------------------------
. ( * @ % & - + ; / at for mod remainder rem <an exponent (**)> and or group having intersect minus order start union where connect || multiset

33/9 PLS-00103: Encountered the symbol "INTO" when expecting one of the following:

. ( ) , * @ % & = - + < / > at in is mod remainder not rem <an exponent (**)> <> or != or ~= >= <= <> and or like like2 like4 likec between || member submultiset

View 39 Replies View Related

SQL & PL/SQL :: How To Calculate Exact Age

Oct 21, 2011

How to calculate exact age for example my date of birth is 10-04-1972 and today current date is 21-10-2011 so i want to calculate age how many years, how many months and how many days.

View 27 Replies View Related

SQL & PL/SQL :: How To Calculate Working Day

Jan 1, 2013

I need a query to find out the working days. I have attached the sample script to create table and data. Here is the description of the tables.

Emp1 : To record the employe's information and weekly rest day.
Attendance :- To record daily attendance.
Leave_appovd : To record the approved leaves.
Holiday : To record the holidays.

W = Attendance
R = Weekly Rest
L = Leave
H = Holiday
A = Absent

Required output is

Emp No.In Date Out Date Type
736912/1/201212/1/2012W
736912/2/201212/2/2012R
736912/3/201212/3/2012W
736912/4/201212/4/2012W
736912/5/201212/5/2012W
736912/6/201212/6/2012L
736912/7/201212/7/2012H
736912/8/201212/8/2012H
736912/9/201212/9/2012R
736912/10/201212/10/2012A
736912/11/201212/11/2012W
736912/12/201212/12/2012W
736912/13/201212/13/2012W
736912/14/201212/14/2012W
736912/15/201212/15/2012L
736912/16/201212/16/2012L
736912/17/201212/17/2012L
736912/18/201212/18/2012W
736912/19/201212/19/2012W
736912/20/201212/20/2012W
736912/21/201212/21/2012W
736912/22/201212/22/2012W
736912/23/201212/23/2012R
736912/24/201212/24/2012A
736912/25/201212/25/2012A
736912/26/201212/26/2012A
736912/27/201212/27/2012W
736912/28/201212/28/2012W
736912/29/201212/29/2012W
736912/30/201212/30/2012R
736912/31/201212/31/2012W
778212/1/201212/1/2012W
778212/2/201212/2/2012W
778212/3/201212/3/2012W
778212/4/201212/4/2012W
778212/5/201212/5/2012W
778212/6/201212/6/2012W

Separate Query will be run for the following output.

Wroking Days
EmpnoAttend WeeklyRestsLeavesHolidays TotalAbsentsG. Total
7369 17 4 4 2 27 4 31
7782 6 0 0 0 6 25 31

If any body work on weekly rest or holiday, it will be considered as weekly rest and holiday. There working on these days will be treated separately.

View 10 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved