SQL translation for use with Oracle

I have 2 Oracle questions

  • How to translate this SQL Server statement to work with Oracle?

     Create table MyCount(Line int identity(1,1))
    
  • What is the equivalent SQL Server image type for storing images in an Orace database?

+3
source share
3 answers

You do not need to use triggers for this if you control inserts:

CREATE SEQUENCE seq;

CREATE TABLE mycount
(
   line NUMBER(10,0)
);

Then, to insert the value:

INSERT INTO mycount(line) VALUES (seq.nextval);

For images, you can use a BLOB to store any binary data, or a BFILE to manage more or less like a BLOB, but the data is stored in a file system, such as a file jpg.

Literature:

+5

1:

 CREATE SEQUENCE MyCountIdSeq;
 CREATE TABLE MyCount (
     Line INTEGER NOT NULL,
     ...
 );
 CREATE TRIGGER MyCountInsTrg BEFORE INSERT ON MyCount FOR EACH ROW AS
 BEGIN
     SELECT MyCountIdSeq.NEXTVAL INTO :new.Line
 END;
 /

2: BLOB.

+5

. Oracle SQL Developer.

- Create Table - 12/18c Identity.

enter image description here

DDL

CREATE TABLE MYCOUNT 
(
  LINE INT GENERATED ALWAYS AS IDENTITY NOT NULL 
);

, - SQL Server Oracle. , .

Scratchpad. "", "".

-, Oracle.

enter image description here

Definitely use the authentication feature in 12 / 18c if you are using this version of Oracle. Fewer db objects to maintain.

+1
source

Source: https://habr.com/ru/post/1705394/


All Articles