Friday, January 31, 2014

Using Virtual Column In a Table In Oracle Database.

Description: Virtual column are generally use for calculate data. Insert or Update operation are not allowed in virtual column. Virtual column are allowed in Oracle 11g Database.

CREATE TABLE EMPLOYEE_INFO
(EMPLOYEE_ID VARCHAR2(20),
 FIRST_NAME VARCHAR2(200),
 SALARY_DAILY NUMBER,
 DAY_IN_MONTH NUMBER,
 MONTHLY_SALARY NUMBER GENERATED ALWAYS AS  (SALARY_DAILY*DAY_IN_MONTH) VIRTUAL)

SQL>
SQL> Insert into EMPLOYEE_INFO
  2     (EMPLOYEE_ID, FIRST_NAME, SALARY_DAILY, DAY_IN_MONTH)
  3   Values
  4     ('120', 'RAJIB', 150, 30);

1 row created.

SQL> select * from EMPLOYEE_INFO;

EMPLOYEE_ID
--------------------
FIRST_NAME
----------------------------------------------------------------
SALARY_DAILY DAY_IN_MONTH MONTHLY_SALARY
------------ ------------ --------------
120
RAJIB
         150           30           4500

Sunday, January 19, 2014

ora-01950 no privileges on tablespace 'users'


Cause: User does not have privileges to allocate an extent in the users tablespace.

Action: Grant the user space resource on the users tablespace.

alter user eftmw quota unlimited on users;

Call Oracle 10g Report Form Oracle Apex Application..

Purpose : I would like to show an 10g oracle report using Oracle Application Express.

Action :
1. Create a table for contain Report URL Information.
2. Create a procedure for return Return Report URL.
3. Create an Oracle Apex Form With 3 Item (Named P12_FROM_DATE, P12_TO_DATE, P12_URL).
4. Create an process Before Header (Name url_assigne)
5. Create an Branch After Processing (Name SHOW_REPORT)
6. Create an Button (SHOW)


1. Create a table for contain Report URL Information.
=========================================================
CREATE TABLE SY_REPORT_CONFIGURATION
(REPORT_SERVER VARCHAR2(30),
 MODULE_NAME    VARCHAR2(30),
 REPORT_EXTENSTION VARCHAR2(10),
 REPORT_FORMAT      VARCHAR2(10),
 REPORT_KEY_NAME    VARCHAR2(30),
 REPORT_FILE_PATH   VARCHAR2(200),
 REPORT_URL             VARCHAR2(300)
)

SET DEFINE OFF;
Insert into IMS.SY_REPORT_CONFIGURATION
   (REPORT_SERVER, MODULE_NAME, REPORT_EXTENSTION, REPORT_FORMAT, REPORT_KEY_NAME, REPORT_FILE_PATH, REPORT_URL)
 Values
   ('IMS', 'IMS', 'RDF', 'PDF', 'IMS',
    'G:\', 'http://10.11.201.200:7778/reports/rwservlet?');
COMMIT;


2. Create a procedure for return Return Report URL.
==========================================================

CREATE OR REPLACE PROCEDURE DPR_REPORT_RUN
(P_MODULE_NAME IN VARCHAR2,
 P_REPORT_FILE_NAME VARCHAR2,
 P_OUTPUE    OUT VARCHAR2)
IS
V_DATA1 VARCHAR2(300);
V_REPORT_SERVER  VARCHAR2(300);
V_MODULE_NAME    VARCHAR2(30);
V_REPORT_EXTENSTION  VARCHAR2(300);
V_REPORT_FORMAT  VARCHAR2(300);
V_REPORT_KEY_NAME  VARCHAR2(300);
V_REPORT_FILE_PATH  VARCHAR2(300);
V_REPORT_URL  VARCHAR2(300);
BEGIN

SELECT LOWER(REPORT_SERVER), LOWER(MODULE_NAME), LOWER(REPORT_EXTENSTION), LOWER(REPORT_FORMAT), LOWER(REPORT_KEY_NAME), LOWER(REPORT_FILE_PATH), LOWER(REPORT_URL)
INTO V_REPORT_SERVER,V_MODULE_NAME , V_REPORT_EXTENSTION, V_REPORT_FORMAT, V_REPORT_KEY_NAME, V_REPORT_FILE_PATH, V_REPORT_URL
FROM SY_REPORT_CONFIGURATION
WHERE LOWER(MODULE_NAME)=LOWER(P_MODULE_NAME);

V_DATA1 := V_REPORT_URL||V_REPORT_KEY_NAME||'&desformat=pdf&destype=cache&paramform=NO&report='||V_REPORT_FILE_PATH||P_REPORT_FILE_NAME;


EXCEPTION
       WHEN NO_DATA_FOUND THEN
                V_DATA1:='URL NOT FOUND '||LOWER(P_MODULE_NAME);
       WHEN TOO_MANY_ROWS THEN
                V_DATA1:='TOO MANY URL FOUND '||LOWER(P_MODULE_NAME);
P_OUTPUE :=V_DATA1;

END;
/

4. Create an process Before Header (Name url_assigne)
==================================================
 Process Code

BEGIN
DPR_REPORT_RUN
(P_MODULE_NAME         =>'IMS',
 P_REPORT_FILE_NAME =>'COMPAY_INFO',
 P_OUTPUE                        =>:P12_URL);
END;



5. Create an Branch After Processing (Name SHOW_REPORT)
==================================================
Target Type : URL

URL Target: &P12_URL.&P_FROM_DATE=&P12_FROM_DATE.&P_TO_DATE=&P12_TO_DATE.



6. Create an Button (SHOW)

Change Button Action : Submit Page
Now Click Show button and see your report ........


Tuesday, January 7, 2014

ORA-12712: new character set must be a superset of old character set

In Oracle Database 10g you can get this error.

For solve this error you can use

ALTER DATABASE CHARACTER SET INTERNAL_USE AL32UTF8;

SQL> ALTER DATABASE CHARACTER SET AL32UTF8;
ALTER DATABASE CHARACTER SET AL32UTF8
*
ERROR at line 1:
ORA-12712: new character set must be a superset of old character set


SQL> ALTER DATABASE CHARACTER SET INTERNAL_USE AL32UTF8;

Database altered.

All steps for change database character parameter.

SQL> SHUTDOWN IMMEDIATE;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> STARTUP RESTRICT;
ORACLE instance started.

Total System Global Area  612368384 bytes
Fixed Size                  1292036 bytes
Variable Size             268437756 bytes
Database Buffers          335544320 bytes
Redo Buffers                7094272 bytes
Database mounted.
Database opened.
SQL> ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0;

System altered.

SQL> ALTER SYSTEM SET AQ_TM_PROCESSES=0;

System altered.

SQL>
SQL>
SQL> ALTER DATABASE CHARACTER SET AL32UTF8;
ALTER DATABASE CHARACTER SET AL32UTF8
*
ERROR at line 1:
ORA-12712: new character set must be a superset of old character set


SQL> ALTER DATABASE CHARACTER SET INTERNAL_USE AL32UTF8;

Database altered.

SQL> SHUTDOWN IMMEDIATE;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> STARTUP;
ORACLE instance started.

Total System Global Area  612368384 bytes
Fixed Size                  1292036 bytes
Variable Size             272632060 bytes
Database Buffers          331350016 bytes
Redo Buffers                7094272 bytes
Database mounted.
Database opened.

Using Bangla(Unicode) In Oracle Database.

SQL> conn /as sysdba
Connected.
SQL>
SQL>
SQL> SHUTDOWN IMMEDIATE;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> STARTUP RESTRICT;
ORACLE instance started.

Total System Global Area  778387456 bytes
Fixed Size                  1374808 bytes
Variable Size             402654632 bytes
Database Buffers          369098752 bytes
Redo Buffers                5259264 bytes
Database mounted.
Database opened.

SQL> ALTER DATABASE CHARACTER SET AL32UTF8;

Database altered.

SQL> SHUTDOWN IMMEDIATE;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> STARTUP;
ORACLE instance started.

Total System Global Area  778387456 bytes
Fixed Size                  1374808 bytes
Variable Size             402654632 bytes
Database Buffers          369098752 bytes
Redo Buffers                5259264 bytes
Database mounted.
Database opened.

Now Check Using Bangla Using Toad 10.5 and  Avro Bangla keyboard.