Identifier Functions UID Correlated With Column Dba_users.user_id

Jul 6, 2012

Is the identifier functions UID always correlated with the column dba_users.user_id ?

View 4 Replies


ADVERTISEMENT

SQL & PL/SQL :: Get User_id When Given Username

Jul 16, 2010

I would like to retrieve user_id when I give username. Could I know which tables I need to be using for that.Example

SQL>@get_User_id Greg
b7dhgs
igh45g

where 'Greg' is a part of the name for 2 users.

View 11 Replies View Related

PL/SQL :: How To Split Column Data Based On Identifier

Oct 3, 2012

I am using oracle database.

I am having data in this format in my column 1234~2345~3456~4567.

I need a query to split the data in the column based on the identifier '~',so that i can pick out the value after the second occurrence of the identifier.

View 3 Replies View Related

SQL & PL/SQL :: Record With User_id / Name And Oldest Timestamps?

Mar 23, 2011

SQL statement:

SELECT user_id, jc_name, upd_time
FROM user_jc
WHERE user_id IN ( SELECT user_id
FROM user_jc
WHERE JC_NAME LIKE 'PPF\_S\_%' ESCAPE ''

[code]...

Howto have for every User_ID and the jc_name with the oldest upd_time? One record for each user_id with the oldest timestamp and the jc_name?

the output should be like this

UII00061PPF_S_SD_1st21.09.2010 19:23:46
UII00012PPF_S_Munich22.03.2011 15:44:20

View 3 Replies View Related

Security :: Restrictions Apply To VPD Functions For Column Masking?

Sep 10, 2013

I want to understand the restrictions that apply to VPD functions when used for column masking, compared with their use for Row-Level Security. According to the Oracle Database Security Guide (11g Release 1)  Column-masking conditions generated by the policy function must be simple Boolean expressions, unlike regular Oracle Virtual Private Database predicates.

 I have long understood the above as implying that column-masking conditions should not contain sub-queries (i.e. inner selects). However, we tested using a condition with a select inside another select (2-level nesting) and yet it worked. We were on 11g Release 2, by the way.  So, I wonder about using sub-queries in column-masking conditions? Or, alternatively, what Oracle means with "regular VPD predicates" and "simple Boolean expressions" (of course, in the context of VPD)? 

View 2 Replies View Related

SQL & PL/SQL :: How To Write Correlated Sub Query

Sep 13, 2010

I have employee, location, city tables, I have written following code to use joins

select ename from employee e, location l, city c
where e.c_locationid= l.locationid and l.cityid= c.cityid and c.cityname='XYZ';

The same can be written by using non- correlated sub query as follow..

select ename
from employee
where c_locationid in (select locationid from location where
cityid in (select cityid from city where cityname='XYZ'))

I need to implement the same concept using correlated sub query...

View 15 Replies View Related

SQL & PL/SQL :: Using Correlated Values In Nested Subquery

Sep 1, 2010

select rtrim(xmlagg(xmlelement(e, table_name||',')).extract('//text()'),',')
from (
select distinct table_name from tr_products tr join all_instruments v
on tr.PROD_COA_ID = v.PROD_COA_ID
where tr.LEVEL_06_VALUE like t1.COLUMN_VALUE||'%'
or tr.LEVEL_05_VALUE like t1.COLUMN_VALUE||'%'
or tr.LEVEL_04_VALUE like t1.COLUMN_VALUE||'%'
or tr.LEVEL_03_VALUE like t1.COLUMN_VALUE||'%'
or tr.LEVEL_02_VALUE like t1.COLUMN_VALUE||'%'
or tr.LEVEL_01_VALUE like t1.COLUMN_VALUE||'%')

This is an excerpt of a code of a huge query, I didn't want to write it all here because there is no point in doing that since this is the part of the query that I'm actually having problem with, and I think you will be able to understand my question just by looking at this piece of code.

Anyway, this here is actually a subquery in a select-clause of a main query, and apparently it has a (nested) subquery of its own (as seen in the code). I want to reach some values ("COLUMN_VALUE") that are correlated to the parent query (t1 is alias of a table in the from-clause of the main query), and as you can see, I'm trying to reach it from this level 2 subquery. As I have recently found out, Oracle does not allow this, it only tollerates correlation down to level 1.

Here is a scheme of my query:

select something1,
(select something2 from
(select something3 from some_table2 t2
where t1.value = t2.value))
from some_table t1

can this be overridden somehow, is there a workaround for this limitation?

View 3 Replies View Related

SQL & PL/SQL :: Correlated Query And Inline View

Apr 9, 2010

which one is better in performance point of view and why between inline view and correlated query.

View 5 Replies View Related

PL/SQL :: Correlated Update (Inline View)

Jan 21, 2013

Can I update inline view like below?

update

(select * from surveys s join answers a on s.survey_id = a.survey_seq_id where month = 201212 and qa = 1 and main_group_id = 55) a,
(select * from surveys s join answers a on s.survey_id = a.survey_seq_id where month = 201212 and qa = 1 and main_group_id = 3) b
where a.survey_id = b.survey_id and substr(a.question_uid , 3) = substr(b.question_uid, 2))

set b.answer = a.answer;

My second question is: The following query is giving error. What can I do?

update answers ans set (ans.answer) = (with a as (select * from surveys s join answers a on s.survey_id = a.survey_seq_id where month = 201212 and qa = 1 and main_group_id = 55),
b as (select * from surveys s join answers a on s.survey_id = a.survey_seq_id where month = 201212 and qa = 1 and main_group_id = 3)
select a.answer from a join b on a.survey_id = b.survey_id and substr(a.question_uid , 3) = substr(b.question_uid, 2) and b.answer_id = ans.answer_id) where ans.main_group_id = 3;

SQL Error: ORA-00904: "ANS"."ANSWER_ID":

View 8 Replies View Related

Refreshing Logically Correlated Snapshots Data?

Nov 29, 2010

Simplifying the data structure that my problem concern, let's say there are two materialized views between whose data there's a one-to-many relationship [the relationship can be logical without a need of creating any foreing keys].

The data should be as actual as possible respecting the content of the master tables, let's say it shoul be refreshed every 5 minutes.

As far as I know, the jobs related to each snapshot, even if they have a START WITH and NEXT parameter set to the same value, work independently...So: what would be the best manner to synchronize the jobs so as to make sure the data of both snapshots are coherent?

View 3 Replies View Related

SQL & PL/SQL :: Advance Sub-queries (Exists With Correlated Subquery)?

Jul 18, 2013

concept of Exists, With and Correlated Subquery in Sql plus 10g from begining, what are they how do they work with step by step example from basic.

View -1 Replies View Related

SQL & PL/SQL :: Building Correlated Subquery Select Statement By Aggregating Timestamps To Months?

Jun 11, 2010

I have 3 tables, user_login_event, person and resource_viewed_event. What I want to do have a report for each month, users logged in our application and then show for each month, how many records were created in table person and how many resource views events were logged in resource_viewed_event.

Lets only worry about the timestamp fields in these tables now as I want to use them to join the tables together or at least build correlated subqueries along the months. I have tried several options, all not leading to a desired result:

Left outer join. Works but its incredibly slow:

SELECT
distinct to_char(ule.TIMESTAMP,'YYYY-MM') as "YYYY-MM",
count(distinct ule.id) as "User Logins",
count(distinct ule.user_id) as "Users logged on",
count(distinct p2.id) as "Existing Users",
count(distinct p1.id) as "New Users",
count(distinct r1.id) as "Resources created"

[code]....

Tried the same with left outer joins of temporary tables created through select statements:

select
distinct ule.month as "Month",
count(distinct p1.user_id) as "Users created",
count (ule.id) as "Logins",
count (distinct ule.user_id) as "Users logged in",
count(rv.id) as "Resource Views",
count(distinct rv.resource_id) as "Resources Viewed"

[code]....

Tried the same with left outer joins of temporary tables created through select statements:

select
distinct ule.month as "Month",
count(distinct p1.user_id) as "Users created",
count (ule.id) as "Logins",
count (distinct ule.user_id) as "Users logged in",
count(rv.id) as "Resource Views",
count(distinct rv.resource_id) as "Resources Viewed"

[code]....

another approach is to create my own temporary tables using select statements and create fixed Month values which I can use to directly link the sets together.

select
distinct ule.loginday as "Month",
count(distinct ule.id) as "Logins",
count(distinct ule.user_id) as "Users logged in",
count(distinct p1.user_id) as "Users created",
count(distinct p2.user_id) as "Existing users1"

[code]....

performance is OK with 2 tables but the example above takes forever to execute.

Tried an approach with union but this creates new rows for each table

SELECT DISTINCT p1.MONTH AS "Month",
COUNT(DISTINCT p1.user_id) AS "Users created",
NULL AS "Logins",
NULL AS "Users Logged in",
NULL AS "Resource views",
NULL AS "Resources viewed"
FROM (SELECT To_char(person.created_on_date, 'YYYY-MM') AS MONTH,

[code]....

View 4 Replies View Related

SQL & PL/SQL :: Invalid Identifier?

Oct 30, 2011

I am trying to do an update with an anonymous PL/SQL block because it has been absolutely impossible to get by the infamous "Single-row subquery returns multiple rows" Whatever.So this code below work... Obviously, I am updating it to a constant.. OK, duh.. Of course it works, it's easy.... Now, I really need to update it to a value in another table that is in my cursor. I believe that I probably need to declare a secondary cursor.

I'm just getting back in the DBA saddle, so I'm a little rusty..

set serveroutput on;
DECLARE
numrows NUMBER := 0;
total NUMBER := 0;
CURSOR upd_record_cur IS SELECT m.rowid, m.swcm_cycle, t.newcycle, p.aprem_no from toad.fswcmas m,

[code]...

Not so good here

ORA-06550: line 20, column 53:
PL/SQL: ORA-00904: "TOAD"."TTP43425_LOAD"."NEWCYCLE": invalid identifier
ORA-06550: line 20, column 10:
PL/SQL: SQL Statement ignored

Doesn't work...
BEGIN
FOR upd_rec IN upd_record_cur LOOP
update toad.fswcmas sw set sw.swcm_cycle = toad.ttp43425_load.newcycle
WHERE rowid = upd_rec.rowid;
total := total + 1;

View 17 Replies View Related

ORA-00972 / Identifier Is Too Long

Feb 5, 2009

I am attempting to run a query to pull some data to fill a data request. However I keep getting the following error, "ERROR at line 1:ORA-00972: identifier is too long."

select FS_CORRESPONDENCE_CODE||';'||CM_FILER_SEQ||';'||CM_ORGNAME||';'||CM_FILER_CODE||';'||
CM_PARTY_CODE||';'||RC_LNAME||';'||RC_FNAME||';'||RC_ORGNAME||';'||RC_MAILADDR1||';'||
RC_MAILADDR2||';'||RC_CITY||';'||RC_STATE||";'||RC_ZIP||';'||RC_OCCUPATION||';'||
RC_EMPLOYER||';'||RC_AMT||';'||
from TREFCM, trefrc, treffs
WHERE CM_FILER_SEQ = RC_FILER_SEQ

[code]....

View 3 Replies View Related

PLS-00201 / Identifier Must Be Declared

Oct 30, 2008

I am trying to execute the below and getting the error:

PLS-00201: identifier 'DBMS.REFRESH' must be declared

The mv is in my schema.. so I am owner. I thought I once read that a dbms.refresh had to be in a block.. so I added the begin and end.. but that didn't resolve it.

I have tried two ways, both resulting in the above error:

execute dbms.refresh('mv_bb_basket');
begin
dbms.refresh('mv_bb_basket');
end;

View 1 Replies View Related

SQL & PL/SQL :: ORA-00972 / Identifier Is Too Long

Jul 14, 2012

SQL> alter system "_allow_level_without_connect_by"=true scope=spfile;
alter system "_allow_level_without_connect_by"=true scope=spfile
*
ERROR at line 1:
ORA-00972: identifier is too long

View 11 Replies View Related

SQL & PL/SQL :: ORA-00904 EID Invalid Identifier

Oct 18, 2013

I'm having an issue creating a table which references a larger table of mine.It gives me the error:

ORA-00904: "EID": invalid identifier

when issuing the command:

CREATE TABLE Phone (P_num CHAR(7), P_type VARCHAR2(10), PRIMARY KEY(P_num), FOREIGN KEY(EID) REFERENCES Employee ON DELETE CASCADE);

I need the employee id (EID) to be the primary key for my table Employee, as described here:

DESC Employee;
Name Null? Type
----------------------------------------- -------- ----------------------------
EID NOT NULL CHAR(7)
E_NAME VARCHAR2(15)
E_ADDRESS VARCHAR2(30)

And since Phone has its own primary key of Pnum, I find it weird that it won't let me reference Phone back to Employee using EID.

View 12 Replies View Related

SQL & PL/SQL :: Declare Identifier In Oracle 10g?

May 22, 2013

When I am running script in oracle 10g ,getting error message as "PLS-00201: identifier 'UTL_SMTP' must be declared".

how to declare identifier 'UTL_SMTP' in oracle 10g or how to give execute access to current user

View 6 Replies View Related

SQL & PL/SQL :: PLS-00201/ Identifier Must Be Declared

Aug 3, 2011

I need export data from remote server i.e. in Oracle8i envtt. but in my machine having client oracle10g.

I m using command from local machine :

expdp test/test@test_env_tns dumpfile=abcd_dat.dat logfile='abcd.log

then i m getting error :

UDE-00008: operation generated ORACLE error 6550
ORA-06550: line 1, column 52:
PLS-00201: identifier 'SYS.DBMS_DATAPUMP' must be declared
ORA-06550: line 1, column 52:
PL/SQL: Statement ignored
[/code]

Note : I m executing command from my local machine command prompt

View 8 Replies View Related

PLS-00201 - Identifier Must Be Declared

Jul 16, 2012

I am using oracle 10g database (10.2.0.1.0), which trouugh an error while i am trying to EXPORT.

View 4 Replies View Related

How To Generate Unique Identifier

Jun 21, 2012

Is there a way to generate a unique identifier(length 8), which can contain numbers (0-9) and letters(a-z) in pl/sql or sql ?

Note :- in oracle 9i.

View 23 Replies View Related

PL/SQL :: Getting Invalid Identifier Error

Jul 24, 2012

select to_char(123.5,'fm$99999.00') from dual

when I execute this I get an output of $123.50...I want to use other speacial characters like @,* instead of $...But I am getting invalid identifier error if I use any special character other than $.

View 5 Replies View Related

SQL & PL/SQL :: Ora-00972 Identifier Is Too Long?

Jan 24, 2012

i have an error while running an SQL statement - ora-00972 identifier is too long.

SELECT
COL_XXXXXXXX,
COL_XXXXXXXXXXX,
COL_XXXXXXXXXXXXXXXXXXXXX,
COL_XXXXXXXXXXXXXX,
COL_XXXXXXXXXXXX,
COL_XXXXXXXXXXXXXXX,
COL_XXXXXXXXXXXX,
COL_XXXXXXXXXXXXXXX,
COL_XXXXXXXXX,
FROM SCHEMA_NAM.TABLE_NAME_XXXXXXXX
WHERE rowid = 0x414142345a63414150414147532f49414178
FOR UPDATE NOWAIT

I've read that the error is caused by object name too long, longer then 30 symbols, to be exact.

The weird thing is that the statement does not have a reference to such a column ableother object name, not that long.

Moreover, when i eliminate the where clause by setting it as remark , i see that the query is executing without an error:

--WHERE rowid = 0x414142345a63414150414147532f49414178

when i look at the max(length(rowid)) from our tables - i see that the value is 18, while the length in the query is 38.

this seems to be the problem, but i don't understand why, and didn't see a proof of it in the documentation.

also, in the log of the application debug, i see another error on executing the exact statement - ORA-00054: resource busy and acquire with NOWAIT specified or timeout expired.

1. What can cause the ora-00972 error? is it the Rowid value?

2. How do i know what is the max length of rowid allowed?

3. is the first error somehow related to ORA-00054?

View 3 Replies View Related

PL/SQL :: Row_Number() Invalid Identifier

Sep 17, 2013

Row_Number() invalid identifier

View 6 Replies View Related

PL/SQL :: Ranking Partitions - Value Identifier

Jul 4, 2012

Lets say I have a table like the following -

ID--------DATE_TIME-----------------VALUE
101----- 01/01/2012 14:00:00 ---12
101----- 11/01/2012 23:00:00 ---17
101----- 13/01/2012 10:00:00 ---22
101----- 19/03/2012 08:00:00 ---7
101----- 19/03/2012 19:00:00 ---7
101----- 19/03/2012 20:00:00 ---7
101----- 20/03/2012 02:00:00 ---3
101----- 20/03/2012 03:00:00 ---3
101----- 21/03/2012 13:00:00 ---14
101----- 21/03/2012 14:00:00 ---14
101----- 21/03/2012 21:00:00 ---13
101----- 21/03/2012 22:00:00 ---13
101----- 21/03/2012 23:00:00 ---13
101----- 22/03/2012 00:00:00 ---13

I'm looking for a script to partition the data into sections where the VALUE is the same over a constant period of time with no breaks. I'd like to give each partition a value to identify it by.

So the outcome of the script would be the following -

ID--------DATE_TIME-----------------VALUE-----IDENTIFIER
101----- 01/01/2012 14:00:00 ---12----------1
101----- 11/01/2012 23:00:00 ---17----------2
101----- 13/01/2012 10:00:00 ---22----------3
101----- 19/03/2012 08:00:00 ---7------------4
101----- 19/03/2012 19:00:00 ---7------------5
101----- 19/03/2012 20:00:00 ---7------------5
101----- 20/03/2012 02:00:00 ---3------------6
101----- 20/03/2012 03:00:00 ---3------------6
101----- 21/03/2012 13:00:00 ---14----------7
101----- 21/03/2012 14:00:00 ---14----------7
101----- 21/03/2012 21:00:00 ---13----------8
101----- 21/03/2012 22:00:00 ---13----------8
101----- 21/03/2012 23:00:00 ---13----------8
101----- 22/03/2012 00:00:00 ---13----------8

I was trying to do something with trunc(date_time) but that didnt work out right as the blocks of data can carry over several days as seen in the rows with IDENTIFIER = 8.

View 7 Replies View Related

SQL & PL/SQL :: WM_CONCAT - Invalid Identifier?

Jul 18, 2011

When iam using wm_concat function in a query in our DB it gave me expected output but when i tried the same thing in another DB of ours it gave me error saying ORA-00904: "WM_CONCAT" : invalid identifier

why am I getting this error or is there any way to concatenate the ouput of a query (seperated by ',')when it is returing unexpected no. of rows.

View 7 Replies View Related

SQL & PL/SQL :: Replace Unique Identifier?

May 27, 2012

How to replace uniqueidentifier in PL/SQL ,I have query like this,

@EmployeeID uniqueidentifier = NULL.

View 11 Replies View Related

SQL & PL/SQL :: Min / Max Functions?

Jun 23, 2011

I have a table that looks like this...

APPOINTMENT
APPOINTMENT PATIENT DENTIST PROCEDURE AMOUNT
NUMBER NUMBER ID NUMBER DATE BILLED PAYMENT
20000001 3001 27 33100 11-Feb-2000 405.00 405.00
20000005 3988 23 11201 05-Mar-2000 80.00 0.00

[code]...

and i used this to find which dentist had the least appointment

select min(count(dentist_ID)) as "Minimum Number of Appointments" from appointment group by dentist_ID;

and this shows..
Minimum Number of Appointments
------------------------------
2

if there's a way where I can show the dentist's ID that corresponds to this "min number of appointment" i tried doing

select dentist_ID, min(count(dentist_ID)) as "Minimum Number of Appointments" from appointment group by dentist_ID;

but it gives me this error

ERROR at line 1:
ORA-00937: not a single-group group function

View 9 Replies View Related

ORA-12154 / TNS - Could Not Resolve The Connect Identifier Specified

Nov 3, 2010

I have installed Oracle 10g client and am trying to connect to an Oracle 9i database with it. I have already created the required Listner and service names. But when I try to login to SQL * Plus , it gives me the following error: Ora-12154: TNS: Could not resolve the connect identifier specified

Could Oracle 10g client connect to a 9i database? If so how do I fix this problem?

View 4 Replies View Related

SQL & PL/SQL :: Package Error - Invalid Identifier?

Mar 4, 2012

way give error in package below

SQL> CREATE OR REPLACE PACKAGE DATA_BKG AS
2
3 TYPE OBJ_DEPT IS RECORD
4 (
5 DEPT_ID NUMBER(10),

[code]...

View 7 Replies View Related







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