Skip to primary content
Skip to secondary content

Climbing Olympus

The Developer Notebook

Main menu

  • Home
  • About
  • Contact
  • Training

Tag Archives: DBMS_METADATA

SQL 12c Revisited

Posted on July 22, 2015 by Biljana Davidovic
Reply

To create a table in the 11.2.0.2.0 database, a developer should create at least 3 schema elements:

  • a table
  • a sequence
  • a trigger

With the Oracle database 12.1.0.2.0, the last two schema elements, the sequence and the trigger, have been eliminated from the table creation process, and the table could be created with an Identity Column.

In the 11.2.0.2.0 release, the table segment is created immediately, but with the version 12.1.0.2.0, the table segment will be created after the first data insert into that particular table.

The next table shows the difference between 12.1.0.2.0 and 11.2.0.2.0 versions of the Oracle database for the SQL statement CREATE TABLE.

CRETE TABLE Statement Differences

RELEASE CREATE TABLE
Oracle Database
11.2.0.2.0
CREATE TABLE "BILJANA"."LEARN"
   (    "ID" NUMBER,
        "ACTION" VARCHAR2(20),
        "RESULT" NUMBER(3,0),
         CONSTRAINT "LEARN_PK" PRIMARY KEY ("ID")
   ) SEGMENT CREATION IMMEDIATE ;

CREATE SEQUENCE "LEARN_SEQ" START WITH 1 INCREMENT BY 1 NOCYCLE NOCACHE;

CREATE TRIGGER LEARN_TR_INSERT
  BEFORE
  INSERT ON LEARN
  FOR EACH ROW
  DECLARE
    l_id number;
  BEGIN
    SELECT LEARN_SEQ.NEXTVAL INTO l_id FROM DUAL;
    :NEW.ID := l_id;
END;
Oracle Database
12.1.0.2.0
CREATE TABLE "BILJANA"."LEARN" 
  (    "ID" NUMBER GENERATED AS IDENTITY
        "ACTION" VARCHAR2(20),
        "RESULT" NUMBER(3,0)
  ) SEGMENT CREATION DEFERRED;

In the schema “BILJANA” there are already some schema objects that we created in the previous post on 19 July 2015. We created the table HowWeLearn with the columns Id, How, and Value, then, we created the sequence Learn_seq, the trigger Learn_Tr_Insert, and the standalone function Funct_Get_Table_DDL.
We are going to rename the table name and the names of its columns and see what problem that action will cause.

biljana@XE> rename howwelearn to learn;

Table renamed.

biljana@XE> alter table learn rename column how to action;

Table altered.

biljana@XE> alter table learn rename column value to result;

Table altered.

The names of the table and its columns are changed successfully. There is a recommendation that comments about the table and its columns should be always added to the database using the SQL statement COMMENT ON.

biljana@XE> COMMENT ON TABLE learn IS 'The table LEARN contains the pairs key/value, where the key is the way how we learn, and the value is the % of how much we remember.';

Comment created.

biljana@XE> COMMENT ON COLUMN learn.action IS 'How we usually learn something: we listen to the teacher, we listen to the audio tape, we watch a video, etc.';

Comment created.

biljana@XE> COMMENT ON COLUMN learn.result IS 'How much we remember, 100% means we remember everything.';

Comment created.

biljana@XE> select TABLE_NAME, COMMENTS
  2  from user_tab_comments
  3  where comments is not null;

TABLE_NAME 
COMMENTS
---------------------------------------------------------------------
LEARN          
The table LEARN contains the pairs key/value, where the key is the way how we learn, and the value is the % of how much we remember.

biljana@XE> select *
  2  from user_col_comments
  3  where comments is not null;

TABLE_NAME                     COLUMN_NAME
------------------------------ ------------------------------
COMMENTS
---------------------------------------------------------------------
LEARN                          ACTION
How we usually learn something: we listen to the teacher, we listen to the audio tape, we watch a video, etc.

LEARN                          RESULT
How much we remember, 100% means we remember everything.

So far, we created the following schema objects:


biljana@XE> select
  2  rpad(substr(object_name,1,18),20)
  3  || rpad(substr(object_type,1,10), 15)
  4  || status OBJECT_STATUS
  5  from user_objects
  6  where created > sysdate - 3
  7  order by 1;

OBJECT_STATUS
----------------------------------------------------------------------------------------------------
FUNCT_GET_TABLE_DDL   FUNCTION       VALID
LEARN                 TABLE          VALID
LEARN_PK              INDEX          VALID
LEARN_SEQ             SEQUENCE       VALID
LEARN_TR_INSERT       TRIGGER        INVALID

Some of the schema objects are VALID and the trigger Learn_Tr_Insert is INVALID.
Let check the definition of the sequence LEARN_SEQ and the trigger LEARN_TR_INSERT.

biljana@XE> select * from user_sequences;

SEQUENCE_NAME MIN_VALUE MAX_VALUE INCREMENT_BY C O CACHE_SIZE LAST_NUMBER
------------- --------  --------- ------------ - - ---------- 
LEARN_SEQ     1         1.0000E+28           1 N N         20          61

The definition of the sequence LEARN_SEQ is unchanged.

biljana@XE> select text from all_source where name like'%LEARN%';

TEXT
-----------------------------------------------------------------------
TRIGGER
LEARN_TR_INSERT
before
insert on LEARN
for each row
declare
var_id number;
begin
select learn_seq.nextval into var_id from dual;
:new.ID := var_id;
end;

As we can see, the change of the table name was done not only in the table definition but also in the trigger definition.
Unfortunately, the trigger has been invalidated as of this change.
What about our function FUNCT_GET_TABLE_DDL? Is it valid or invalid? We expect the function to be INVALID, but it is not. WHY?
Let list the function code that is saved in the static data dictionary view ALL_SOURCE.


biljana@XE> select text from all_source where name like'%FUNCT%';

TEXT
----------------------------------------------------------------------------------------------------
FUNCTION funct_get_table_ddl
RETURN CLOB
AUTHID CURRENT_USER
IS

-- Define local variables.

  l_h NUMBER; --handle returned by OPEN
  l_th NUMBER; -- handle returned by ADD_TRANSFORM
  l_doc CLOB; --returned sql ddl statement

BEGIN

-- Specify the object type.

  l_h := DBMS_METADATA.OPEN('TABLE');

-- Use filters to specify the particular object desired.

  DBMS_METADATA.SET_FILTER(l_h,'SCHEMA','BILJANA');

  DBMS_METADATA.SET_FILTER(l_h,'NAME','HOWWELEARN');

-- Request that the metadata be transformed into creation DDL.

  l_th := DBMS_METADATA.ADD_TRANSFORM(l_h,'DDL');

-- Fetch the object.

  l_doc := DBMS_METADATA.FETCH_CLOB(l_h);

-- Release resources.

  DBMS_METADATA.CLOSE(l_h);

-- Return the result

  RETURN l_doc;

EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE(SQLERRM);
END;

42 rows selected.

The function body has NOT been changed accordingly. WHY? Because we put the literal strings (highlighted) instead of formal function parameters inside the body of the function.

If we execute the function, the error will be generated:

biljana@XE> select funct_get_table_ddl from dual;
ERROR:
ORA-06503: PL/SQL: Function returned without value
ORA-06512: at "BILJANA.FUNCT_GET_TABLE_DDL", line 42

no rows selected

ORA-31603: object "HOWWELEARN" of type TABLE not found in schema "BILJANA"

Again, we will check the validity of the function:

biljana@XE> select
  2    rpad(substr(object_name,1,20),25)
  3    || rpad(substr(object_type,1,10), 15)
  4    || status OBJECT_STATUS
  5    from user_objects
  6    where created > sysdate - 3
  7    order by 1;

OBJECT_STATUS
----------------------------------------------------------------------------------------------------
FUNCT_GET_TABLE_DDL      FUNCTION       VALID
LEARN                    TABLE          VALID
LEARN_PK                 INDEX          VALID
LEARN_SEQ                SEQUENCE       VALID
LEARN_TR_INSERT          TRIGGER        INVALID

The function is still valid and the trigger is still invalid.

As of the trigger, it should only be recompiled:


biljana@XE> alter trigger learn_tr_insert compile;

Trigger altered.

biljana@XE> select
  2    rpad(substr(object_name,1,20),25)
  3    || rpad(substr(object_type,1,10), 15)
  4    || status OBJECT_STATUS
  5    from user_objects
  6    where created > sysdate - 3
  7    order by 1;

OBJECT_STATUS
----------------------------------------------------------------------------------------------------
FUNCT_GET_TABLE_DDL      FUNCTION       VALID
LEARN                    TABLE          VALID
LEARN_PK                 INDEX          VALID
LEARN_SEQ                SEQUENCE       VALID
LEARN_TR_INSERT          TRIGGER        VALID

The function needs to be rewritten with formal input parameters for the schema object type, the schema name, and schema object name:


biljana@XE>  drop function funct_get_table_ddl;

biljana@XE> CREATE OR REPLACE FUNCTION funct_get_ddl
  2    (  p_in_type VARCHAR2
  3     , p_in_schema VARCHAR2
  4     , p_in_name VARCHAR2 )
  5  RETURN CLOB
  6  AUTHID CURRENT_USER
  7  IS
  8  
  9  -- Define local variables.
 10  
 11    l_h NUMBER; --handle returned by OPEN
 12    l_th NUMBER; -- handle returned by ADD_TRANSFORM
 13    l_doc CLOB; --returned sql ddl statement
 14  
 15  BEGIN
 16  
 17  -- Specify the object type.
 18  
 19    l_h := DBMS_METADATA.OPEN(p_in_type);
 20  
 21  -- Use filters to specify the particular object desired.
 22  
 23    DBMS_METADATA.SET_FILTER(l_h,'SCHEMA',p_in_schema);
 24    DBMS_METADATA.SET_FILTER(l_h,'NAME',p_in_name);
 25  
 26  -- Request that the metadata be transformed into creation DDL.
 27  
 28    l_th := DBMS_METADATA.ADD_TRANSFORM(l_h,'DDL');
 29  
 30  -- Fetch the object.
 31  
 32    l_doc := DBMS_METADATA.FETCH_CLOB(l_h);
 33  
 34  -- Release resources.
 35  
 36    DBMS_METADATA.CLOSE(l_h);
 37  
 38  -- Return the result
 39  
 40    RETURN l_doc;
 41  
 42  EXCEPTION
 43  WHEN OTHERS THEN
 44  DBMS_OUTPUT.PUT_LINE(SQLERRM);
 45  END;
 46  /

Function created.

Elapsed: 00:00:00.18

Now, we can get DDL statements for all schema objects that we created:


biljana@XE> SET PAGESIZE 0
biljana@XE> SET LONG 1000000
biljana@XE> set timing on

biljana@XE>  SELECT funct_get_ddl('TABLE','BILJANA','LEARN') from dual;

  CREATE TABLE "BILJANA"."LEARN"
   (	"ID" NUMBER,
	"ACTION" VARCHAR2(20),
	"RESULT" NUMBER(3,0),
	 CONSTRAINT "LEARN_PK" PRIMARY KEY ("ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DE
FAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "SYSTEM"  ENABLE
   ) SEGMENT CREATION IMMEDIATE
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DE
FAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "SYSTEM"


Elapsed: 00:00:07.21

biljana@XE>  SELECT funct_get_table_ddl('TRIGGER','BILJANA','LEARN_TR_INSERT') from dual;

  CREATE OR REPLACE TRIGGER "BILJANA"."LEARN_TR_INSERT"
before
insert on LEARN
for each row
declare
var_id number;
begin
select learn_seq.nextval into var_id from dual;
:new.ID := var_id;
end;
ALTER TRIGGER "BILJANA"."LEARN_TR_INSERT" ENABLE


Elapsed: 00:00:00.54

biljana@XE>  SELECT funct_get_ddl( 'SEQUENCE' ,'BILJANA','LEARN_SEQ') from dual;

   CREATE SEQUENCE  "BILJANA"."LEARN_SEQ"  MINVALUE 1 MAXVALUE 99999999999999999
99999999999 INCREMENT BY 1 START WITH 61 CACHE 20 NOORDER  NOCYCLE


Elapsed: 00:00:00.34


biljana@XE> SELECT funct_get_ddl( 'FUNCTION' ,'BILJANA','FUNCT_GET_DDL') FROM DUAL;

  CREATE OR REPLACE FUNCTION "BILJANA"."FUNCT_GET_DDL"
  (  p_in_type VARCHAR2
   , p_in_schema VARCHAR2
   , p_in_name VARCHAR2 )
RETURN CLOB
AUTHID CURRENT_USER
IS

-- Define local variables.

  l_h NUMBER; --handle returned by OPEN
  l_th NUMBER; -- handle returned by ADD_TRANSFORM
  l_doc CLOB; --returned sql ddl statement

BEGIN

-- Specify the object type.

  l_h := DBMS_METADATA.OPEN(p_in_type);

-- Use filters to specify the particular object desired.

  DBMS_METADATA.SET_FILTER(l_h,'SCHEMA',p_in_schema);
  DBMS_METADATA.SET_FILTER(l_h,'NAME',p_in_name);

-- Request that the metadata be transformed into creation DDL.

  l_th := DBMS_METADATA.ADD_TRANSFORM(l_h,'DDL');

-- Fetch the object.

  l_doc := DBMS_METADATA.FETCH_CLOB(l_h);

-- Release resources.

  DBMS_METADATA.CLOSE(l_h);

-- Return the result

  RETURN l_doc;

EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE(SQLERRM);
END;


Elapsed: 00:00:00.50

biljana@XE> select
  2    rpad(substr(object_name,1,20),25)
  3    || rpad(substr(object_type,1,10), 15)
  4    || status OBJECT_STATUS
  5    from user_objects
  6    where created > sysdate - 3
  7    order by 1;
FUNCT_GET_DDL            FUNCTION       VALID
LEARN                    TABLE          VALID
LEARN_PK                 INDEX          VALID
LEARN_SEQ                SEQUENCE       VALID
LEARN_TR_INSERT          TRIGGER        VALID

Elapsed: 00:00:00.04

Now, all schema objects are VALID and we can continue with other programming.

Summary

In this post I showed what changes the release 12.1.0.2.0 brought to us regarding the SQL CREATE TABLE statement.

Then, we learned what happened if the body of the PL/SQL function contains the literal strings of the schema object names.

The function will produce the error any time we call it if the exact names of our schema objects were changed in the meantime.

The checking with the queries on the USER_OBJECTS table and its column STATUS will mislead us.

We should always avoid using the literal strings of the schema object names in the body of any PL/SQL subprogram.

I hope this will be helpful for anyone who would like to learn more about Oracle Database.

Thank you for visiting my blog!

Have a nice day!

P.S. Keep climbing Mount Olympus ( I mean keep learning and make things happen ) !

Share this:

  • Twitter
  • LinkedIn
  • Email
  • Print

Like this:

Like Loading...
Posted in Database | Tagged all_source, ALTER TABLE, alter trigger, COMMENT ON, CREATE TABLE, DBMS_METADATA, drop function, GENERATED AS IDENTITY, Identity Column, INVALID, NEXTVAL, RENAME, SEGMENT CREATION DEFERRED, user_col_comments, user_objects, user_sequences, user_tab_comments, VALID | Leave a reply

Set up the test environment for database-centric applications

Posted on July 19, 2015 by Biljana Davidovic
Reply

The free version of the Oracle Database 11g2 express edition could be downloaded from the

http://www.oracle.com/technetwork/database/database-technologies/express-edition/downloads/index.html

xe11g_downloads

The documentation about the installation of the database and the application development could be found on
http://www.oracle.com/technetwork/database/database-technologies/express-edition/documentation/index.html

xe11g2_documents

The list of documents on the next picture shows that there are a lot of to be read, learn, and practice.
The first to be read is the License document, then the Installation Guide, the Getting Started Guide, etc.

xe11g2DocumentList

After the successful download of the database 11g2 on a Windows XP 32-bit computer,
here are the steps of the installation process that would take a couple of minutes:
step#1 Click twice on the DISK/setup.exe file to start the installation.

xe11g_install

step#2 Then, accept the terms in the Oracle license agreement.

xe11g_install_step2

step#3 Next, choose destination location for the database files.

xe11g_install_step3

step#4 Next, decide about the password for the database accounts SYS and SYSTEM.

xe11g_install_step4

step#5 Review all settings such as destination folders and ports.

xe11g_install_step5

step#6 After a few minutes, the successful installation would finish with this message.

xe11g_install_step6

step#7 Start the Oracle 11g2 database by clicking on
AllPrograms=> Oracle Database 11g Express Edition => Get Started.

Start11g2

step#8 The Database would start in the Google Chrome Browser on the “127.0.0.1:8080/apex/”.

InGoogleChrome

step#9 Click on Storage and login as the SYS user.

LoginAsSYS

step#10 The Storage page would show the current tablespaces: SYSAUX, SYSTEM, UNDO, TEMP, and USER, and their free and used spaces in MB.

xe11g2_tablespaces

step#11 Logout from the database.
step#12 Open the Microsoft Command Prompt window and connect to the database as sysdba by using SQL*Plus command user interface.

SQL> sqlplus / as sysdba

sys@XE> select instance_name || version from v$instance;

INSTANCE_NAME||VERSION
---------------------------------
xe11.2.0.2.0

step#13 Unlock user “HR” account, change its password, and test it to be sure that all is set up correctly

sys@XE> ALTER USER hr ACCOUNT UNLOCK;

User altered.

sys@XE> ALTER USER hr IDENTIFIED BY hr;

User altered.

sys@XE> connect hr/hr
Connected.

hr@XE> select * from tab;

TNAME TABTYPE CLUSTERID
------------------------------ ------- ----------
COUNTRIES TABLE
DEPARTMENTS TABLE
EMPLOYEES TABLE
EMP_DETAILS_VIEW VIEW
JOBS TABLE
JOB_HISTORY TABLE
LOCATIONS TABLE
REGIONS TABLE

8 rows selected.

hr@XE> connect / as sysdba
Connected.

step#14 Create a new schema

sys@XE> create user biljana identified by davidovic;

User created.

sys@XE> grant CREATE SESSION, ALTER SESSION, CREATE DATABASE LINK, -
> CREATE MATERIALIZED VIEW, CREATE PROCEDURE, CREATE PUBLIC SYNONYM, -
> CREATE ROLE, CREATE SEQUENCE, CREATE SYNONYM, CREATE TABLE, -
> CREATE TRIGGER, CREATE TYPE, CREATE VIEW, UNLIMITED TABLESPACE -
> to biljana;

Grant succeeded.

sys@XE> connect biljana/davidovic
Connected.

biljana@XE> select * from tab;

TNAME TABTYPE CLUSTERID
------------------------------ ------- ----------
APEX$_ACL TABLE
APEX$_WS_FILES TABLE
APEX$_WS_HISTORY TABLE
APEX$_WS_LINKS TABLE
APEX$_WS_NOTES TABLE
APEX$_WS_ROWS TABLE
APEX$_WS_TAGS TABLE
APEX$_WS_WEBPG_SECTIONS TABLE
APEX$_WS_WEBPG_SECTION_HISTORY TABLE
DEMO_CUSTOMERS TABLE
DEMO_ORDERS TABLE
DEMO_ORDER_ITEMS TABLE
DEMO_PRODUCT_INFO TABLE
DEMO_STATES TABLE
DEMO_USERS TABLE
DEPT TABLE
EMP TABLE

17 rows selected.

step#15 Create a new table

biljana@XE> CREATE TABLE "BILJANA"."HOWWELEARN"
( "ID" NUMBER,
"HOW" VARCHAR2(20),
"VALUE" NUMBER(3,0);

Table created.

biljana@XE> alter table howwelearn add constraint test_pk primary key (id);
Table altered.

biljana@XE> CREATE SEQUENCE learn_seq START WITH 1 INCREMENT BY 1 NOCYCLE NOCACHE;
Sequence created.

biljana@XE> create trigger LEARN_TR_INSERT
before
insert on howwelearn
for each row
declare
var_id number;
begin
select learn_seq.nextval into var_id from dual;
:new.ID := var_id;
end;

Trigger created.

biljana@XE> insert into howwelearn(how, value) values( 'Lecture',5 );
1 row created.

step#16 Create the function funct_get_table_ddl and get DDL statement about the created table ‘HowWeLearn’

biljana@XE> CREATE OR REPLACE FUNCTION funct_get_table_ddl
RETURN CLOB
AUTHID CURRENT_USER
IS

-- Define local variables.

l_h NUMBER; --handle returned by OPEN
l_th NUMBER; -- handle returned by ADD_TRANSFORM
l_doc CLOB; --returned sql ddl statement

BEGIN

-- Specify the object type.

l_h := DBMS_METADATA.OPEN('TABLE');

-- Use filters to specify the particular object desired.

DBMS_METADATA.SET_FILTER(l_h,'SCHEMA','BILJANA');
DBMS_METADATA.SET_FILTER(l_h,'NAME','HOWWELEARN');

-- Request that the metadata be transformed into creation DDL.

l_th := DBMS_METADATA.ADD_TRANSFORM(l_h,'DDL');

-- Fetch the object.

l_doc := DBMS_METADATA.FETCH_CLOB(l_h);

-- Release resources.

DBMS_METADATA.CLOSE(l_h);

-- Return the result

RETURN l_doc;

EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE(SQLERRM);
END;
/

biljana@XE> SET PAGESIZE 0
biljana@XE> SET LONG 1000000
biljana@XE> SELECT funct_get_table_ddl FROM dual;
biljana@XE> set timing on
biljana@XE> SELECT funct_get_table_ddl FROM dual;

CREATE TABLE "BILJANA"."HOWWELEARN"
( "ID" NUMBER,
"HOW" VARCHAR2(20),
"VALUE" NUMBER(3,0),
CONSTRAINT "LEARN_PK" PRIMARY KEY ("ID")
USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DE
FAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "SYSTEM" ENABLE
) SEGMENT CREATION IMMEDIATE
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DE
FAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "SYSTEM"
Elapsed: 00:00:01.12

step#17 The data inserted into the table “HOWWELEARN” has been taken from my favorite YouTube channel GoogleTechTalks.

Here is the section from its ABSTRACT:

Explore the brain’s amazing ability to change throughout a person’s life. This phenomenon—called neuroplasticity—is the science behind brain fitness, and it has been called one of the most extraordinary scientific discoveries of the 20th century.

PBS had recently aired this special, The Brain Fitness Program, which explains the brain’s complexities in a way that both scientists and people with no scientific background can appreciate.

This is opportunity to learn more about how our minds work—and to find out more about the latest in cutting-edge brain research, from the founder of Posit Science and creator of the Brain Fitness Program software, Dr. Michael Merzenich.
The video “Think faster focus better and remember more – Rewiring our brain to stay younger” by Dr. Michael Merzenich can be watched on YouTube on


And, here is the important message learned:

biljana@XE> select 'After ' ||
rpad(how,15) ||
' We Learn ONLY ' ||
nvl(value,0) || '%'
from howwelearn;

After Lecture We Learn ONLY 5%
After Reading We Learn ONLY 10%
After Audio We Learn ONLY 20%
After Visual We Learn ONLY 20%
After Demonstration We Learn ONLY 30%
After Discussion We Learn ONLY 50%
After Practice by doing We Learn ONLY 75%
After Teach others We Learn ONLY 90%
After Nothing We Learn ONLY 0%

9 rows selected.

Elapsed: 00:00:00.00
biljana@XE>

As we can see from the result set, we remember things mostly only as we start teaching others about it.

Summary

In this post the test environment for the applications that are database-centric has been set up using the free express edition of the Oracle database 11g2.
I hope this will be helpful for anyone who would like to learn more about Oracle Database.

Thank you for visiting my blog!

Have a nice day!

P.S. Keep climbing Mount Olympus ( I mean keep learning and make things happen ) !

Share this:

  • Twitter
  • LinkedIn
  • Email
  • Print

Like this:

Like Loading...
Posted in Database | Tagged ADD CONSTRAINT, ALTER TABLE, APEX, CHR, CREATE FUNCTION, CREATE SEQUENCE, CREATE TRIGGER, Create User, database, DBMS_METADATA, GRANT, INSERT, NEXTVAL, Oracle database 11g2, PL/SQL, SELECT, SQL, SQLPlus, V$INSTANCE | Leave a reply

B.Davidovic Certifications

Biljana Davidovic Certifications

Recent Posts

  • 2015 in review
  • 6 Times More LinkedIn Profile Views with The Oracle Digital Certification Badges
  • Mozilla Open Badges Standard
  • Create Pluggable Database using the seed database as a template
  • TRUE or FALSE – 12.1.0.2 Extended Period of Support is June 2021

Archives

  • December 2015
  • November 2015
  • October 2015
  • September 2015
  • August 2015
  • July 2015

Categories

  • Certification
  • Database
  • Personal Branding
  • Personal Marketing
Blog at WordPress.com.
Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy
  • Follow Following
    • Climbing Olympus
    • Already have a WordPress.com account? Log in now.
    • Climbing Olympus
    • Customize
    • Follow Following
    • Sign up
    • Log in
    • Report this content
    • View site in Reader
    • Manage subscriptions
    • Collapse this bar
 

Loading Comments...
 

You must be logged in to post a comment.

    %d bloggers like this: