Showing posts with label oracle. Show all posts
Showing posts with label oracle. Show all posts

Monday, February 29, 2016

Lever et activer les contraintes d'un schéma Oracle

Désactivation

BEGIN FOR c IN (SELECT c.owner, c.table_name, c.constraint_name FROM user_constraints c, user_tables t WHERE c.table_name = t.table_name AND c.status = 'ENABLED' ORDER BY c.constraint_type DESC) LOOP dbms_utility.exec_ddl_statement('alter table ' || c.owner || '.' || c.table_name || ' disable constraint ' || c.constraint_name); END LOOP; END; 

Activation

BEGIN FOR c IN (SELECT c.owner, c.table_name, c.constraint_name FROM user_constraints c, user_tables t WHERE c.table_name = t.table_name AND c.status = 'DISABLED' ORDER BY c.constraint_type) LOOP dbms_utility.exec_ddl_statement('alter table ' || c.owner || '.' || c.table_name || ' enable constraint ' || c.constraint_name); END LOOP; END;

Source : http://www.silverlake.fr/index.php?post/2010/12/11/Lever-et-activer-les-contraintes-Oracle

Thursday, February 25, 2016

Equivalent type TEXT MySQL in Oracle

Oracle has BLOB, CLOB and NCLOB for storing binary, character and unicode character data types. You can also specify the LOB storage area which allows a DBA to fine tune the storage if necessary (i.e. putting the LOB data on separate disks)

Check this out : http://docs.oracle.com/cd/B10501_01/server.920/a96524/c13datyp.htm#13754

Thursday, February 11, 2016

Oracle Keywords

The following words also have a special meaning to Oracle but are not reserved words and so can be redefined. However, some might eventually become reserved words.

ADMINCURSORFOUNDMOUNT
AFTERCYCLEFUNCTIONNEXT
ALLOCATEDATABASEGONEW
ANALYZEDATAFILEGOTONOARCHIVELOG
ARCHIVEDBAGROUPSNOCACHE
ARCHIVELOGDECINCLUDINGNOCYCLE
AUTHORIZATIONDECLAREINDICATORNOMAXVALUE
AVGDISABLEINITRANSNOMINVALUE
BACKUPDISMOUNTINSTANCENONE
BEGINDOUBLEINTNOORDER
BECOMEDUMPKEYNORESETLOGS
BEFOREEACHLANGUAGENORMAL
BLOCKENABLELAYERNOSORT
BODYENDLINKNUMERIC
CACHEESCAPELISTSOFF
CANCELEVENTSLOGFILEOLD
CASCADEEXCEPTMANAGEONLY
CHANGEEXCEPTIONSMANUALOPEN
CHARACTEREXECMAXOPTIMAL
CHECKPOINTEXPLAINMAXDATAFILESOWN
CLOSEEXECUTEMAXINSTANCESPACKAGE
COBOLEXTENTMAXLOGFILESPARALLEL
COMMITEXTERNALLYMAXLOGHISTORYPCTINCREASE
COMPILEFETCHMAXLOGMEMBERSPCTUSED
CONSTRAINTFLUSHMAXTRANSPLAN
CONSTRAINTSFREELISTMAXVALUEPLI
CONTENTSFREELISTSMINPRECISION
CONTINUEFORCEMINEXTENTSPRIMARY
CONTROLFILEFOREIGNMINVALUEPRIVATE
COUNTFORTRANMODULEPROCEDURE

PROFILESAVEPOINTSQLSTATETRACING
QUOTASCHEMASTATEMENT_IDTRANSACTION
READSCNSTATISTICSTRIGGERS
REALSECTIONSTOPTRUNCATE
RECOVERSEGMENTSTORAGEUNDER
REFERENCESSEQUENCESUMUNLIMITED
REFERENCINGSHAREDSWITCHUNTIL
RESETLOGSSNAPSHOTSYSTEMUSE
RESTRICTEDSOMETABLESUSING
REUSESORTTABLESPACEWHEN
ROLESQLTEMPORARYWRITE
ROLESSQLCODETHREADWORK
ROLLBACKSQLERRORTIME

Oracle Reserved Words

The following words are reserved by Oracle. That is, they have a special meaning to Oracle and so cannot be redefined. For this reason, you cannot use them to name database objects such as columns, tables, or indexes.

ACCESSELSEMODIFYSTART
ADDEXCLUSIVENOAUDITSELECT
ALLEXISTSNOCOMPRESSSESSION
ALTERFILENOTSET
ANDFLOATNOTFOUNDSHARE
ANYFORNOWAITSIZE
ARRAYLENFROMNULLSMALLINT
ASGRANTNUMBERSQLBUF
ASCGROUPOFSUCCESSFUL
AUDITHAVINGOFFLINESYNONYM
BETWEENIDENTIFIEDONSYSDATE
BYIMMEDIATEONLINETABLE
CHARINOPTIONTHEN
CHECKINCREMENTORTO
CLUSTERINDEXORDERTRIGGER
COLUMNINITIALPCTFREEUID
COMMENTINSERTPRIORUNION
COMPRESSINTEGERPRIVILEGESUNIQUE
CONNECTINTERSECTPUBLICUPDATE
CREATEINTORAWUSER
CURRENTISRENAMEVALIDATE
DATELEVELRESOURCEVALUES
DECIMALLIKEREVOKEVARCHAR
DEFAULTLOCKROWVARCHAR2
DELETELONGROWIDVIEW
DESCMAXEXTENTSROWLABELWHENEVER
DISTINCTMINUSROWNUMWHERE
DROPMODEROWSWITH

Monday, October 12, 2015

Installing PHP and the Oracle Instant Client for Linux and Windows

Installing PHP and the Oracle Instant Client for Linux and Windows


Configuration de PHP avec OCI8


High performance PHP applications with Oracle Database


Instant Client Downloads for Microsoft Windows (32-bit)

Call to undefined function oci-connect php oci8

php --ri oci8

PHP Warning:  PHP Startup: Unable to load dynamic library 'C:\php-5.2.8\ext\php_
oci8.dll' - %1 is not a valid Win32 application.
 in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'C:\php-5.2.8\ext\php_
pdo_oci8.dll' - %1 is not a valid Win32 application.
 in Unknown on line 0
Extension 'oci8' not present.

Aprés installation du client oracle oci8

php --ri oci8
PHP Warning:  PHP Startup: Invalid library (maybe not a PHP library) 'php_pdo_oc
i8.dll'  in Unknown on line 0

oci8

OCI8 Support => enabled
Version => 1.2.5
Revision => $Revision: 1.269.2.16.2.43 $
Active Persistent Connections => 0
Active Connections => 0
Temporary Lob support => enabled
Collections support => enabled

Directive => Local Value => Master Value
oci8.max_persistent => -1 => -1
oci8.persistent_timeout => -1 => -1
oci8.ping_interval => 60 => 60
oci8.privileged_connect => Off => Off
oci8.statement_cache_size => 20 => 20
oci8.default_prefetch => 10 => 10
oci8.old_oci_close_semantics => no value => no value

Friday, January 30, 2015

How to check character set in Oracle

One of the requirements for samePage is that the character set should be UTF-8. 

You can either check with your DBA or run the following SQL to determine whether your database character set is UTF-8. 

SELECT value$ FROM sys.props$ WHERE name = 'NLS_CHARACTERSET' ;

It should return the value AL32UTF8. 

Another option is to run the following SQL :

SELECT * FROM NLS_DATABASE_PARAMETERS

The value against NLS_CHARACTERSET should be UTF8.

Source : http://support.etouch.net/cm/wiki/?id=43321

Wednesday, December 12, 2012

[ORACLE/PLSQL] Using the single ampersand substitution variable : &

The single ampersand (&) substition variable causes Oracle to stop and prompt the user for a value before executing the command. This si a very good tool when the developer wants to use the same query to retrieve  different set of data

Example :

SELECT &colname FROM &tabname WHERE &colname IS NOT NULL;

Result: