Difference between revisions of "Oracle"

From database24
Jump to navigation Jump to search
Line 18: Line 18:
  
 
== FAQ ==
 
== FAQ ==
 +
 +
=== How do I realize a certain field type? ===
 +
{| class="wikitable"
 +
|+ align="bottom" | Oracle: Data Type Table Field Definitions
 +
! Type !! Oracle !! Comment
 +
|-
 +
| Boolean || NUMBER(1,0) || Store 0 and -1
 +
|-
 +
| Integer || NUMBER(5,0)
 +
|-
 +
| Long Integer || NUMBER(11,0)
 +
|-
 +
| Text || VARCHAR2(255) || Access Text Field
 +
|}
  
 
=== How do I realize an auto-incrementing field? ===
 
=== How do I realize an auto-incrementing field? ===

Revision as of 00:32, 18 June 2011


Configuration

Processes

  • ORA-12516: TNS:listener could not find available handler with matching protocol stack
    • Edit %oracle_home%/database/init<SID>.ora
    • Add
PROCESSES=200

Flashback

In order to make use of something like

FLASHBACK TABLE MYTABLE TO TIMESTAMP TO_TIMESTAMP('2010-12-31 23:59:59');

it is necessary to enable row movement.


FAQ

How do I realize a certain field type?

Oracle: Data Type Table Field Definitions
Type Oracle Comment
Boolean NUMBER(1,0) Store 0 and -1
Integer NUMBER(5,0)
Long Integer NUMBER(11,0)
Text VARCHAR2(255) Access Text Field

How do I realize an auto-incrementing field?

CREATE TABLE MYTABLE (
    ID NUMBER(11, 0) NOT NULL 
    );

CREATE SEQUENCE MYTABLE_ID_SEQ
    START WITH 1 
    INCREMENT BY 1 
    NOMAXVALUE; 

CREATE TRIGGER MYTABLE_ID_TRG
    BEFORE INSERT ON MYTABLE
    FOR EACH ROW
    BEGIN
        SELECT MYTABLE_ID_SEQ.NEXTVAL 
          INTO :NEW.ID 
          FROM DUAL;
    END;

How do I rollback to a previously specified point?

SAVEPOINT MYSAVEPOINT;
-- ...
ROLLBACK TO MYSAVEPOINT;

How do I rollback to a certain time?

FLASHBACK TABLE MYTABLE TO TIMESTAMP TO_TIMESTAMP('2010-12-31 23:59:59');


Errors

ORA-00911

  • Pass Through Queries must not have a semicolon at the end of the SQL statement.