I try to execute this but it gives an error at the default tablespace. I want to give a default tablespace to the users I create but how?
BEGIN
FOR USERNAME IN (SELECT studentname from students)
LOOP
EXECUTE IMMEDIATE 'CREATE USER ' || USERNAME.studentname || ' IDENTIFIED BY ' || USERNAME.studentname;
EXECUTE IMMEDIATE 'DEFAULT TABLESPACE "USERS"';
EXECUTE IMMEDIATE 'TEMPORARY TABLESPACE "TEMP"';
EXECUTE IMMEDIATE 'GRANT STUDENT TO ' || USERNAME.studentname ;
END LOOP;
END;
Error report - ORA-00900: invalid SQL statement ORA-06512: at line 5 00900. 00000 - "invalid SQL
EXECUTE IMMEDIATEthat did the wholeCREATE USERincluding the default and temporary tablespace. Of course, you'd want to ensure that you have appropriate whitespace in your DDL statement (spaces beforeDEFAULTandTEMPORARYfor example).default tablespace