Substitute variable in script [message #638826] |
Mon, 22 June 2015 12:17 |
|
ajaapba
Messages: 2 Registered: June 2015 Location: ATLANTA
|
Junior Member |
|
|
Hi,
This is one of the script that runs on production system during deployment.
It sets the default password for some of the schemas.
However, I don't under stand what below code does exactly ? Can I get any help on this.
DECLARE
ls_sql VARCHAR2(2000);
v1 number;
CURSOR c1 IS
SELECT 1
FROM dba_tables
WHERE owner = 'AXIOM'
AND table_name = 'PWDSAVE';
BEGIN
ls_sql := 'CREATE TABLE axiom.pwdsave AS ';
ls_sql := ls_sql||'SELECT name as username, password FROM sys.user$ ';
ls_sql := ls_sql||'WHERE name IN (''AXIOM'',''AXIOM_ARCHIVE'',''AXIOSS_INTERNET'',''CUSTOM'',''UTAXIOSS'',''DASHBOARD'',
''EMS'',''EMS_API'',''HOMS'',''HOMS_API'',''HOMS_SYSTEM_AUTOMATIC'',
''FASTSTREAM'',''IMS_API'',''O2S_API'',''PAF'',''SAFE'',''XML_LIB'',''SAFE_API'',''COMMON_API'')';
OPEN c1;
FETCH c1 into v1;
IF c1%NOTFOUND THEN
EXECUTE IMMEDIATE ls_sql;
ELSE
dbms_output.put_line('Using existing saved password table...');
END IF;
CLOSE c1;
END;
/
|
|
|
|
|
|
Re: Substitute variable in script [message #638847 is a reply to message #638827] |
Tue, 23 June 2015 09:04 |
|
ajaapba
Messages: 2 Registered: June 2015 Location: ATLANTA
|
Junior Member |
|
|
This is the output from DBMs Output
CREATE TABLE axiom.pwdsave AS SELECT name as username, password FROM sys.user$
WHERE name IN
('AXIOM','AXIOM_ARCHIVE','AXIOSS_INTERNET','CUSTOM','UTAXIOSS','DASHBOARD',
'EMS','EMS_API','HOMS','HOMS_API','HOMS_SYSTEM_AUTOMATIC
',
'FASTSTREAM','IMS_API','O2S_API','PAF','SAFE','XML_LIB',
'SAFE_API',
'COMMON_API')
|
|
|
Re: Substitute variable in script [message #638850 is a reply to message #638847] |
Tue, 23 June 2015 09:08 |
gazzag
Messages: 1118 Registered: November 2010 Location: Bedwas, UK
|
Senior Member |
|
|
It dynamically generates that code which creates a table PWDSAVE in the AXIOM schema that contains the username and the encrypted database password for the users mentioned in the IN clause.
|
|
|
|
|