SQL & PL/SQL :: Finding Value Of Bits From Hex Number?

Jan 12, 2012

Version : Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production

I have a source which is of datatype RAW(1). Basic requirement is to convert it into binary, and then lookup the value of the 4th and 6th bit. Is this possible using simple SQL ?

Eg.

DataBinary
----- -------
EF1110 1111

From this binary output, i need to find the value of 4th and 5th bit.
So if the 4th bit is 1, I need to perform some operations if 0 then some other.

Create table test_hex_to_bin (col1 raw(1));

INSERT into test_hex_to_bin values ('99');
INSERT into test_hex_to_bin values ('EF');
INSERT into test_hex_to_bin values ('AB');

Basically the output should read as

Bit_number Value
----------------
4 1
5 0

View 5 Replies


ADVERTISEMENT

SQL & PL/SQL :: Finding Number Of Pattern Occurrences In String?

Feb 4, 2012

The code which I am working on consists of an incoming dynamic string which be in the form of binary digits. The max size of the string will be 12 digits. For example, the string can be '111011000001', '000000000000', '111111011111', etc.

I need to find the number of occurences of '111' in the incoming string. Say in the 1st example, result will be 1, in the 2nd example result will be 0, and in the third example, the result will be 3.

I have been trying to capture the string length and replacing the variables '111' to find the number of occurences, but it isn't giving me the result that I want. This is what I have tried

SQL> conn hr/hr
Connected.
SQL> show user
USER is "HR"

[Code]....

I searched the forum and found a similar topic, and following that guideline, I even tried dividing the string with the length of the pattern. It works in some scenarios (the first and second examples mentioned below), while it fails in some scenarios (third example mentioned below)

SQL> select (length('11101110111') - length(replace('11101110111','111','')))/length('111') as occurences from dual;

OCCURENCES
----------
3

SQL> select (length('110111110111') - length(replace('110111110111','111','')))/length('111') as occurences from dual;

OCCURENCES
----------
2

SQL> select (length('111111111111') - length(replace('111111111111','111','')))/length('111') as occurences from dual;

OCCURENCES
----------

SQL>

View 13 Replies View Related

Forms :: Finding Out Port Number And Oracle ID For Compilation?

May 21, 2010

Is there any way i could figure out what is the current port number used in an existing setup of oracle forms in a linux server.

Is there any specific oracle id i should use to compile oracle forms on server?

View 5 Replies View Related

SQL & PL/SQL :: Finding Record In Table Having Value For Maximum Number Of Columns

Nov 25, 2011

if there is any inbuilt function or way to find a row in the table that is having value for maximum number of columns.

For example, the table A has 5 columns
(c1,c2,c3,c4,c5) and it has 3 records(r1,r2,r3)
and
r1 has values only for c1,c2
r2 has values only for c1,c2,c3,c4
r3 has values only for c1

so I should get the result as "r3 has values for 4 columns & it is not having value for column c5".

View 4 Replies View Related

Forms :: Possible To Install And Execute Developer 2000 In A Laptop Using Windows 7 64 Bits?

Jul 5, 2011

Is it possible to install and execute Developer 2000 in a laptop using windows 7 64 bits?

View 1 Replies View Related

Installation :: 11g R2 In Fedora 17 (32 Bits) System - Oracle Patch To Enable DB Console?

Apr 23, 2013

I have been working in the installation of oracle 11g r2 in my fedora 17 (32 bits) system for a few days and still have not gotten.Now I found that I need the OPtatch for enable the db console and even being a member of My Oracle Support I can not request the patch for a technical question.

1) Note to the Approver: I am that one because I am an end user (freelance)

2) Support Identifier: How can I get it?

View 6 Replies View Related

PL/SQL :: Finding The Max Value

Jun 19, 2013

I have the following query where i need to find the max value[code]  with t as 

(   select 'L1' R_nm ,'Data' R_Data , 'Obj' R_Obj , 'Wd' r_prec , '2' val 
from dual   union all   select 'L1' , 'Data', 'Obj' , 'No', '4'
from dualunion all   select 'L2' , 'Data', 'Obj' , 'No', '4' from dual )  
select t.*, max(val) over(partition by r_nm,r_data,r_obj)  rk from t[/code] 

My expected output should be
[code]

r_nm    r_data     r_obj   r_prec   val     rkL1        Data         Obj     Wd       2       1L1        Data         Obj     No       4        2L2        Data         Obj     Yes      1       1

[/code]

View 1 Replies View Related

SQL & PL/SQL :: Not Finding The Foreign Key?

Dec 4, 2011

I'm not really sure why oracle is not finding my Foreing Key, I'm creating an easy set of table for a company and I'm declaring all Primary keys and foreing keys as necessary and this is my

CREATE TABLE Items
(ItemID NUMBER(5) NOT NULL,
Description VARCHAR2(30),
ListPrice NUMBER(9,2) NOT NULL,
QtyOnHand Number(5),
ReorderPoint NUMBER(3),
ReorderQty NUMBER(3),
OnBackOrder Number(3),
CONSTRAINT ItemsPK

[Code] ............

There's three sets of inserts the first two successfully inserts the data NO problem but when i try to insert the data on SupplierItems comes as:

ERROR at line 1:
ORA-02291: integrity constraint (jcarter.SUPPLIERITEMSFK2) violated - parent key not found

I looked on the forum and it appears this happens when someone is doing a Insert ALL but this is not my case..

View 2 Replies View Related

PL/SQL :: Finding ID Max (salary)

Oct 31, 2012

Select * from one:

ID SALARY
----------------------
10 1000
20 2000
30 3200

Select * from two:

ID SALARY
----------------------
10     1000
20     2000
40     4000
10     3000
20     4000
30     3000

When i try to find ID,MAX(SALARY) from these two tables, i am getting this output:

Select id,max(salary)
from
(select * from one
union
select * from two)
group by id
order by max(salary) desc;

OUTPUT:

ID MAX(SALARY)
--------------------------------------
20     4000
40     4000
30     3200
10     3000

I want OUTPUT to be like this:

ID MAX(SALARY)
--------------------------------------
20     4000
40     4000

View 3 Replies View Related

Finding 10 Most Recent Missions

Jun 23, 2008

What i have is table with:

mission_id, mission_type_id, security_level and code_name.

What i have to do is get the 10 most recent missions and change their security level to the highest one in their mission_type_id but ONLY if code_name length is >7

So far I have this, the problem is that the oracle moans about the order and wants me to close the bracket before the order

sql

UPDATE missions m
SET m.security_level = (
SELECT max(m2.security_level)
FROM missions m2
WHERE m2.mission_type_id = m.mission_type_id
AND length(m2.code_name) > 7
)
WHERE m.mission_ID IN (
Select m3.mission_id
From missions m3
ORDER BY m3.mission_id desc)

View 3 Replies View Related

Finding Alert Log File

Dec 23, 2011

How can i come to know that which current alert log file is being used for database? Is their a command at database level to find out the current alert log file to which database is using ?

View 2 Replies View Related

Finding Primary Key In A Table?

Oct 4, 2007

Whats the command to show the name of the primary key in a table using oracle sql plus?

View 1 Replies View Related

Finding Unused Index

Nov 3, 2008

I have read and used the AWR script (mentioned in the page Finding unused index for finding unused customised (Z) indexes in our SAP system using oracle 10.2.0.2 as the SAP database.

But this returns no rows. Is there any precondition? I want to know how much / many times the indexes are used...We are smelling that lot of unused index are there in the database.

View 8 Replies View Related

Finding Permission Tables

May 30, 2011

How to find the list of tables which has permission select only and tables which has both read and write access permission for a particular user.

I'm using ORACLE database.

View 1 Replies View Related

SQL & PL/SQL :: Finding The Difference Between IN And EXIST?

Nov 22, 2011

finding the difference between IN and EXIST.

View 15 Replies View Related

SQL & PL/SQL :: Finding Session IDs Initiated By Particular Job

Feb 7, 2012

I want to track the session id that has been initiated by a particular job (I have job ids with me). Which dictionary views I can get this result.

View 1 Replies View Related

SQL & PL/SQL :: Finding Values In A Range?

Nov 1, 2011

@test.sql
accept 1 num prompt 'enter begin value '
accept 2 num prompt 'enter end value '

Need to display all values between the above given inputs.
No tables involved.
Need SQL level solution in version 8i.

View 4 Replies View Related

SQL & PL/SQL :: Finding Duplicate Records

May 20, 2010

i have table with name, count, flag with dublicate records

example

with swayam name , counts are 3, 4
with ramana name, counts are 5,5
with reddy name, counts are 1,2,3

i want to update the flag

if count are same then update one of record (flag='A') and other should be flag='R'
if count are different then update the max count (flag='A') and other should be reject remaing (flag='R'). use below quires

CREATE TABLE TEST_DUB ( NAME VARCHAR2(99), V_COUNT NUMBER, FLAG VARCHAR2(1));

Insert into TEST_DUB (NAME, V_COUNT)
Values
('SWAYAM', 3);
Insert into TEST_DUB
(NAME, V_COUNT)
Values

[Code]....

View 4 Replies View Related

SQL & PL/SQL :: Finding The Corresponding Index Partition?

Aug 1, 2012

I have a partitioned tables and local partitioned index on the same.

I want to know that a particular index partition belong to which table partition.

View 1 Replies View Related

SQL & PL/SQL :: Mac Address Finding Using Oracle

Sep 26, 2011

we can find the IP address in V$session table. Is it possible to find the mac address of user's computer?

View 13 Replies View Related

Finding Correct DB Process?

Feb 7, 2013

1. I have 6 data bases, one process is running slowly, how do you find which data base that process belongs to?

2. I have 6 data bases, only one data base we have ASM instance, how do you find which data base has ASM?

View 1 Replies View Related

SQL & PL/SQL :: Finding Double Vowels

Dec 14, 2010

I am reading Section 4-8 (page 42/216) in the Oracle Database 2-day Developer Guide from here:

[Code]....

It reads:

Suppose that you want to select every employee whose last name has a double vowel(two adjacent occurrences of the same vowel).

Example 4.9 shows how you can do this.

The regular expression ([AEIOU]) represents any vowel. The metacharacter 1 represents the first (and in this case, only) regular expression. The third function parameter, 'i', specifies that the match is case-insensitive.

Example 4.9 Selecting All Employees Whose Last Names Have Double Vowels

SELECT FIRST_NAME, LAST_NAME
FROM EMPLOYEES
WHERE REGEXP_LIKE(LAST_NAME, '([AEIOU])1', 'i');

Result is similar to:

FIRST_NAME LAST_NAME
-------------------- -------------------------
Harrison Bloom
Lex De Haan
Kevin Feeney
Ki Gee
Nancy Greenberg
Danielle Greene
Alexander Khoo
David Lee

8 rows selected.

I don't understand how [AEIOU])1 would find a double vowel(two adjacent occurrences of the same vowel).

View 6 Replies View Related

SQL & PL/SQL :: Finding The Cost Of Query

Sep 2, 2010

I am using oracle 10g, i want to know the cost of query. In the explain plan and by auto trace am able to get some query cost, but i dont know how to calculate the query cost.

How i will know the query is costly and take more time..? But i know about the hash table and nested tables in the explain plan.
Other than this how to calculate the query cost..?

View 5 Replies View Related

SQL & PL/SQL :: Finding A String With Different Substrings?

Mar 28, 2012

I tried this query .. but no luck / I know it has some errors

SQL> select invoice_num from ap_invoices_all where rownum < 10 and invoice_num in ('%1%','%2%');

no rows selected

View 9 Replies View Related

PL/SQL :: Finding Table_name Or Column_name

Jan 15, 2013

I have inserted through frontend which is ORACLE ADF and if i want to see those inserted data's in a table then how to check it when i dont know the table names and if there are large number of tables available.. Its I need a solution in this way as i know the values of fields so by giving values alone I want to fetch the table and column names as wherever this values are present...I am already aware about user_tab_columns and user_tables or all_tables .. So i want to try through fetching of tables or column names though values or data's as reference ...

View 21 Replies View Related

Forms :: Finding Data

Jan 26, 2010

I have simple table:

code = CHAR(5) as primary key
name = VARCHAR2(bla blal ba)

There is one-block-form based on this table. Block's datasource type = table and datatarget type = pl/sql procedure

Table API, Module API - all generated, all valid and seems correct. Now.. I try to update "name" from form. As soon as I type in something in the field, I get message "Row no longer exists". When digging deeper it seems that problem raises from lock_prodecure:

DECLARE
bk_data CGC$CL_1_9_DKD.cgc$rec_tab;
BEGIN
PLSQL_TABLE.POPULATE_TABLE(bk_data, 'DKD', PLSQL_TABLE.LOCK_RECORDS);
CGC$CL_1_9_DKD.lck(bk_data);
END;

It seems, it has some problems on populating the "code" attribute in bk_data.

how to solve this problem without massive re-coding??.

View 24 Replies View Related

SQL & PL/SQL :: Finding UNIQUE Combination

Oct 4, 2012

I have contents like below:

BREAD,BISCUIT
BREAD,MILK,BISCUIT
COKE,MILK
MILK,SUGAR

Now combination from each row will be like below (Just for understanding):

BREAD,BISCUIT --> [COMBINATION] {BISCUIT} {BREAD} {BISCUIT,BREAD}
BREAD,MILK,BISCUIT --> [COMBINATION] {BISCUIT} {BREAD} {MILK} {BISCUIT,BREAD} {BISCUIT,MILK} {BREAD,MILK} {BISCUIT,BREAD,MILK}
COKE,MILK --> [COMBINATION] {COKE} {MILK} {COKE,MILK}
MILK,SUGAR --> [COMBINATION] {MILK} {SUGAR} {MILK,SUGAR}

Now the ultimate aim is to find unique combinations (even if the same combination is present in different rows, we have to consider it as one combination), along with its frequency, result will be like below:

BISCUIT [occurence in 2 transactions and total 4 transactions] = 2/4 = .5
BREAD [occurence in 2 transactions and total 4 transactions] = 2/4 = .5
COKE [occurence in 1 transactions and total 4 transactions] = 2/4 = .25
MILK = 3/4 = .75

[Code]....

writing query to find unique combination like above? What I have tried is as below:

create table test (row_no number, col_no number, item varchar2(50))
/

insert into test values (1,1,'BREAD');
insert into test values (1,2,'BISCUIT');
insert into test values (2,1,'BREAD');

[Code]....

But I am not able to form the exact query. let me know if this can't be done through a single query.

View 20 Replies View Related

PL/SQL :: Finding Column Name In Database?

Sep 17, 2012

I'm sure one of the databases we keep has a column called UNIT_PRICE, is there a way for me to get Oracle SQL Developer find all databases with columns named that?

View 2 Replies View Related

Finding Correlation Using Derived Columns?

May 13, 2007

I want to use the aggregate CORR_S function which take two numerical columns and output the correlation between them. Assuming I have the table:

Employee(name, gender, salary) where I want to create two derived columns, how would I do it?

Like,
-------------------
SELECT CORR_S(
SELECT salary
FROM employees
WHERE salary < 10000,
SELECT salary
FROM employees
WHERE salary > 10000
) as correlation
FROM employees
---------------------

It will find the correlation between salary's less than $10,000 in one column and salary's more than $10,000 in another column. Of course, I get an error when running the query. It's no problem if I use CORR_S(salary, salary) but I want to use derived columns, is it possible? Or, will I need to create a new table view with two new columns CORR_S(lowSalary, highSalary)?

View 1 Replies View Related

Finding Time Between Last Two Redolog Switches?

Sep 6, 2010

how to find the time between the last two redolog switches?

View 1 Replies View Related







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