dcsimg
Database Journal
MS SQL Oracle DB2 Access MySQL PostgreSQL Sybase PHP SQL Etc SQL Scripts & Samples Tips Database Forum

» Database Journal Home
» Database Articles
» Database Tutorials
MS SQL
Oracle
DB2
MS Access
MySQL
» RESOURCES
SQL Scripts & Samples
Tips
» Database Forum
» Slideshows
» Sitemap
Free Newsletters:
DatabaseDaily  

By submitting your information, you agree that databasejournal.com may send you databasejournal offers via email, phone and text message, as well as email offers about other products and services that databasejournal believes may be of interest to you. databasejournal will process your information in accordance with the Quinstreet Privacy Policy.

News Via RSS Feed


Database Journal |DBA Support |SQLCourse |SQLCourse2
 

Featured Database Articles

SQL Scripts & Samples

Posted December 14, 2015

WEBINAR:
On-Demand

How to Help Your Business Become an AI Early Adopter


Generate Random Passwords

>>Script Language and Platform: Oracle-PL/SQL
Use this script to generate a random password.

Author: Renan Medeiros

create or replace function gera_passwd return varchar2 is passwd  varchar2(30);
passw1  varchar2(30);
passw2  varchar2(30);
passw3  varchar2(30);
passw4  varchar2(30);
zecond  number;
begin
   select dbms_random.string('Z', 3),
          trunc(dbms_random.value(091, 999)),
          dbms_random.string('Z', 2),
          trunc(dbms_random.value(07, 87))
   into   passw1,
          passw2,
          passw3,
          passw4
   from   dual;
   dbms_output.put_line('Password: '||passwd);
   zecond := to_number(to_char(sysdate,'ss'));
   if   zecond > 60
   then zecond := zecond - 60;
   end  if;
    if   zecond >= 0
   and  zecond < 16
   then passwd := passw1||passw2||passw3||passw4;
   elsif    zecond > 15
       and  zecond < 31
       then passwd := passw3||passw2||passw4||passw1;
       elsif    zecond > 30
           and  zecond < 46
           then passwd := passw3||passw1||passw4||passw2;
           else passwd := passw1||passw2||passw4||passw3;
   end  if;
   return(passwd);
end;


Disclaimer: We hope that the information on these script pages is valuable to you. Your use of the information contained in these pages, however, is at your sole risk. All information on these pages is provided "as -is", without any warranty, whether express or implied, of its accuracy, completeness, or fitness for a particular purpose... Disclaimer Continued

Back to Database Journal Home



SQL Scripts & Samples Archives

Comment and Contribute

 


(Maximum characters: 1200). You have characters left.

 

 




Latest Forum Threads
SQL Scripts & Samples Forum
Topic By Replies Updated
sql help!! add 1 August 22nd, 11:58 AM
How To Combine These 2 Queries into 1 Query ? tarek_land 1 June 7th, 08:37 AM
solving query svibuk 1 February 3rd, 06:08 AM
converting from a character string to uniqueidentifier saturnius 4 January 4th, 05:56 AM











×
We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.