PL/SQL :: See All Accounts With Product_code

Oct 22, 2012

I have table with Account, Transaction_date and Product_code columns.

a.)I want to see all the accounts with Product_code = 3120173, i know this is straight forward.

b.) I want to see all the accounts with Product_code = 3120346 but their most recent Product_code should be Product_ code= 3120173. So basically i need to perform a check before i pull Accounts that are on Product_code = 3120346 to see if their most recent(Transaction_date) Product_code= 3120173.

View 2 Replies


ADVERTISEMENT

SQL & PL/SQL :: Updating Accounts And Displaying Changes?

Aug 13, 2012

I'm trying to write procedures to make updating account owners and the like easier for a group of DBA's.

What I want to do, is create a procedure that displays the changes live.

e.g. If I changed the owner of 5 users from owner 100 to owner 200 it will display:

User test1 owner changed from 100 to 200
User test2 owner changed from 100 to 200
User test3 owner changed from 100 to 200
User test4 owner changed from 100 to 200
User test5 owner changed from 100 to 200

I can not get a loop to work to save my life. Here's what I have to update the account so far...

PROCEDURE UPDATE_OWNER (OWNER NUMBER, NEW_OWNER NUMBER) IS
BEGIN

UPDATE ACCOUNT_TRACKING
SET ACCOUNT_OWNER=NEW_OWNER WHERE ACCOUNT_OWNER = OWNER
AND ACCOUNT_TYPE !='P';
DBMS_OUTPUT.PUT_LINE ('Account Owner '||OWNER||' Changed to '||NEW_OWNER);
END UPDATE_OWNER;

View 4 Replies View Related

Expiring All User Accounts In Profile

May 16, 2012

I am trying to expire all user accounts belonging to a particular profile my_profile.

The first option was to utilise the utlpwdmg.sql script to update the PASSWORD_LIFE_TIME for my_profile, this worked in Oracle (11g) but caused issues with the change password feature of several applications linking to the database - this option then had to be abandoned.

The next option is to therefore to select all users in my_profile and expire the accounts, what I require is a statement to combine:

- Select USERNAME from DBA_USERS where PROFILE='my_profile';
&
- Alter USER my_user PASSWORD EXPIRE;

So that all users in my_profile have their passwords expired, not just one user my_user.

View 2 Replies View Related

SQL & PL/SQL :: Trigger For Updating Two Accounts After Money Transfer

Feb 21, 2012

I get a "ORA-00922 missing or invalid option" after compiling the following trigger:

create or replace
trigger aifer_transfer
after insert on transfer
for each row
[code]......

I want the trigger to affect the transferring account (from_account) with minus the "amount" being transferred from it, and the account transferred to (to_account) with plus the "amount" being transferred to it. My tables looks as following:

TRANSFER
----------------------------------------- -------- ------------
ROWNR NOT NULL NUMBER(9)
PNO NOT NULL VARCHAR2(11)
FROM_ACCOUNTNO NOT NULL NUMBER(8)
TO_ACCOUNTNO NOT NULL NUMBER(8)
AMOUNT NUMBER(10,2)
DATE NOT NULL DATE

ACCOUNT Null? Type
----------------------------------------- -------- ------------
ACCOUNTNO NOT NULL NUMBER(8)
KTNR NOT NULL NUMBER(6)
REGDATE NOT NULL DATE
BALANCE NUMBER(10,2)

View 5 Replies View Related

SQL & PL/SQL :: Automate Locking / Unlocking Of User Accounts

Nov 1, 2011

I have been plagued by people logging into my database and making changes when a clone is in process.. Having said that ,I am looking to lock accounts and unlock them when I am done.

I envision my code looking something like this:

sqlplus -s / <<END
SET PAGESIZE 0
SET FEEDBACK OFF
SET VERIFY OFF;
set heading off;
spool /tmp/lockusers.sql
select 'alter user ' || username || ' account lock;' from dba_users where username not in (....) and not locked?;
spool off;
END;

sqlplus -s / <<END
@/tmp/lockusers.sql
END;

When it comes time to unlock the accounts I want to be able to unlock those accounts I previously locked and not all of them. Is there a query, I can use that can tell me when the accounts were locked or some other way about going about this so I dont unlock accounts that were locked prior to my lock script running?

View 9 Replies View Related

Security :: Lock User Accounts In Oracle Database

Jul 12, 2011

I have a doubt in locking user account in oracle database.I was told to drop some unusable users in database which my clients dont require them.I verified the dependent objects of those users but not sure if these users can be dropped.

Instead can i make those user accounts locked so that they cannot connect to database? Would there be any impact on database performance if i lock those user accounts?

Is locking an account and dropping users is similar in anyway?

View 12 Replies View Related

Express Edition (XE) :: Display A List Of All User And Admin Accounts

Jan 28, 2013

I've installed XE and I want to know what accounts are active. If I log in to SQL*Plus as sys as SYSDBA how can I display a list of all user and admin accounts? I want to know who can log in.

View 3 Replies View Related







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