oracle 9i - SQL data types

zVlad
Уже с Приветом
Posts: 15410
Joined: 30 Apr 2003 16:43

Post by zVlad »

Lazy44 wrote:....
Sorry for offtopic. Try to compare DB2 SQL PL and Oracle PL/SQL - It is earth and sky. DB2 SQL PL is very limited. Function in DB2 SQL PL can not contain several statements. You must do all your logic in one statement. There is no provided packages by IBM . Oracle has close to 100 packages.


DB2 SQL PL (Control Statements, actually) was introduced just recently. There were no needs for this analog of Oracle's PL/SQL other than to make it easier to port applications from Oracle to DB2.
User avatar
Dmitry67
Уже с Приветом
Posts: 28294
Joined: 29 Aug 2000 09:01
Location: SPB --> Gloucester, MA, US --> SPB --> Paris

Post by Dmitry67 »

JustMax wrote:
Dmitry67 wrote:try catch ?
Выгляните в окно - уже занимается на востоке светлая заря коммунизма. В смысле YUKON.


Во! еще один YUKONOM пугает ! 8O :mrgreen:
Да шож в ем такого будет, что все Oracle - овцы от зависти лопнут ?! :(


Как Вы не знаете ?
SQL версионником стал
И крантец Ларри настал :)

А версионность данных там пальцики оближешь
Зарегистрированный нацпредатель, удостоверение N 19719876044787 от 22.09.2014
User avatar
Dmitry67
Уже с Приветом
Posts: 28294
Joined: 29 Aug 2000 09:01
Location: SPB --> Gloucester, MA, US --> SPB --> Paris

Post by Dmitry67 »

zVlad wrote: DB2 SQL PL (Control Statements, actually) was introduced just recently. There were no needs for this analog of Oracle's PL/SQL other than to make it easier to port applications from Oracle to DB2.


Ну в свете 40 лет mainframes, вуйствительно, just recently
Но по моему уже лет десять
Зарегистрированный нацпредатель, удостоверение N 19719876044787 от 22.09.2014
User avatar
JustMax
Уже с Приветом
Posts: 1476
Joined: 05 Dec 2000 10:01
Location: Vilnius -> Bonn

Post by JustMax »

zVlad wrote: - recursive query (WITH statement, common table expression)?
- multy-row INSERT?
- SELECT .... FROM INSERT ?
- static queries? (Queries are stored in data base server in compiled and ready to be executed form).
multi-deminsioned clusterering index?

This are just SQL related stuff.


regular expressions :

SELECT * FROM dusers WHERE REGEXP_LIKE (name, '^Ste(v|ph)en$');

recursive queries : connect by .. start with ... etc.

multy-row insert : INSERT ... FROM SELECT ... ?

static queries : stored function with ref cursor return type ?

multi-deminsioned clusterering index : Xм.. не использовал надо посмотрть в документации.
User avatar
JustMax
Уже с Приветом
Posts: 1476
Joined: 05 Dec 2000 10:01
Location: Vilnius -> Bonn

Post by JustMax »

Dmitry67 wrote:Как Вы не знаете ?
SQL версионником стал
И крантец Ларри настал :)

А версионность данных там пальцики оближешь


Знаем.
(Тихо так) И ето все ? Хотя, конечно, ето много.
А какая еще более версионная версионность (нужна) бывает ? :oops:
User avatar
Dmitry67
Уже с Приветом
Posts: 28294
Joined: 29 Aug 2000 09:01
Location: SPB --> Gloucester, MA, US --> SPB --> Paris

Post by Dmitry67 »

JustMax wrote:Знаем.
(Тихо так) И ето все ? Хотя, конечно, ето много.
А какая еще более версионная версионность (нужна) бывает ? :oops:


Еще есть with (common table expression)
Рекурсивные квери для деревьев (слизано из Оракла :) )
А версионность лучше потому что в ней никогда не возникнет 'snapshot is too old'
Зарегистрированный нацпредатель, удостоверение N 19719876044787 от 22.09.2014
zVlad
Уже с Приветом
Posts: 15410
Joined: 30 Apr 2003 16:43

Post by zVlad »

Dmitry67 wrote:
zVlad wrote: DB2 SQL PL (Control Statements, actually) was introduced just recently. There were no needs for this analog of Oracle's PL/SQL other than to make it easier to port applications from Oracle to DB2.


Ну в свете 40 лет mainframes, вуйствительно, just recently
Но по моему уже лет десять


Control Statements were indroduced in DB2 version 7 in 2001 (I believe).
Once again, before that there were no needs to have something like PL/SQL. For example, I knew about PL/SQL for long time, but I was and I am still OK with REXX and DB2 REXX interface. REXX can be more powerful than PL/SQL
User avatar
Dmitry67
Уже с Приветом
Posts: 28294
Joined: 29 Aug 2000 09:01
Location: SPB --> Gloucester, MA, US --> SPB --> Paris

Post by Dmitry67 »

Ой, извините, я думал это про Oracle. Я увидел PL/SQL и подумал Oracle.
Кстати, zVlad, а почему таки были ввделены control of flow statements в SQL ?
ПОльзователям DB2 надоело трахаться с написанием кода процедур на C ?
Зарегистрированный нацпредатель, удостоверение N 19719876044787 от 22.09.2014
User avatar
JustMax
Уже с Приветом
Posts: 1476
Joined: 05 Dec 2000 10:01
Location: Vilnius -> Bonn

Post by JustMax »

Dmitry67 wrote:
JustMax wrote:Знаем.
(Тихо так) И ето все ? Хотя, конечно, ето много.
А какая еще более версионная версионность (нужна) бывает ? :oops:


Еще есть with (common table expression)
Рекурсивные квери для деревьев (слизано из Оракла :) )
А версионность лучше потому что в ней никогда не возникнет 'snapshot is too old'


Имея неграниченный UNDO tablespace с очень большим retention time ету ошибку и в Oracle (теоритически) не получить. Законы физики однако :pain1: . Кде собака то порылась ? И за чей счет ето достигается в Юконе ? :wink:
User avatar
Dmitry67
Уже с Приветом
Posts: 28294
Joined: 29 Aug 2000 09:01
Location: SPB --> Gloucester, MA, US --> SPB --> Paris

Post by Dmitry67 »

В Youkon вроде версии хранятся в tempdb. tempdb может расти
Версии чистятся самим сервреом при завершении транзакций или отсыхании коннекций (а не уходят сами просто со временем как в Oracle)
Поэтому если у вас есть изменение маленькой таблицы, а потом Вы начинаете генерировать лог гигабайтами апдейтя все другие, то это никак не приведет к тому что версия данных этой маленькой таблицы устареет
То есть история каждой таблицы независима...
Зарегистрированный нацпредатель, удостоверение N 19719876044787 от 22.09.2014
zVlad
Уже с Приветом
Posts: 15410
Joined: 30 Apr 2003 16:43

Post by zVlad »

JustMax wrote:regular expressions :

SELECT * FROM dusers WHERE REGEXP_LIKE (name, '^Ste(v|ph)en$');

recursive queries : connect by .. start with ... etc.

multy-row insert : INSERT ... FROM SELECT ... ?

static queries : stored function with ref cursor return type ?

multi-deminsioned clusterering index : Xм.. не использовал надо посмотрть в документации.



1. Regular expression. To me (DBA) it is a bad practics to make data evaluator from DBMS. This practic makes impossible to choose good access path to data. On the other hand, there are many ways to resolve what you showed in your example.
2. I am no an expert in recursive queries, I know Oracle has recursive query. But I heard from my friend who is an Oracle programer, that DB2 has something which is impossible for Oracle in this area. You'd better to have a look at DB2 manuls, if you wish.
3. Not exactly. Stored function is a stored function. Static applications (queries) are again something special. In what you said (stored function), does Oracle create access paths for queries at once (when function is created) and never change it? Or every time when function is called Oracle will create new access paths on fly?
zVlad
Уже с Приветом
Posts: 15410
Joined: 30 Apr 2003 16:43

Post by zVlad »

Dmitry67 wrote:Ой, извините, я думал это про Oracle. Я увидел PL/SQL и подумал Oracle.
Кстати, zVlad, а почему таки были ввделены control of flow statements в SQL ?
ПОльзователям DB2 надоело трахаться с написанием кода процедур на C ?


I don't know. My guess is for making it easier to port applications from Oracle to DB2.
If I would need to write stored procedures I would use REXX rather than Control Statements or C. What is also interesting that needs to write stored procedudures are relativaly lower than in case of Oracle and? MS SQL - thanks to static queries and applications. From how it is used, DB2's static applications are the same as Oracle stored procedures. From how it is implemented, DB2's statics are different from Oracle's functions and procedures. We already spoke about it.
User avatar
Dmitry67
Уже с Приветом
Posts: 28294
Joined: 29 Aug 2000 09:01
Location: SPB --> Gloucester, MA, US --> SPB --> Paris

Post by Dmitry67 »

zVlad wrote:1. Regular expression. To me (DBA) it is a bad practics to make data evaluator from DBMS. This practic makes impossible to choose good access path to data.


Зелен виноград :)
Зарегистрированный нацпредатель, удостоверение N 19719876044787 от 22.09.2014
User avatar
JustMax
Уже с Приветом
Posts: 1476
Joined: 05 Dec 2000 10:01
Location: Vilnius -> Bonn

Post by JustMax »

zVlad wrote:3. Not exactly. Stored function is a stored function. Static applications (queries) are again something special. In what you said (stored function), does Oracle create access paths for queries at once (when function is created) and never change it? Or every time when function is called Oracle will create new access paths on fly?


Но ето же проблема для оптимизации. Как тогда оптимизатор реагирует на изменения статистики по вовлеченным
в запрос обьектам ? Перекомпилирует процедуру с новым execution plan ?! Если нет - то нафиг такое удовольствие. В Оracle
- если есть такое желание, можно в select явно указать execution plan hint и оптимизатор больше не будет парится. Единственный
overhead здесь, по сравнению с compiled query, что при первичном
вызове query Oracle нужно ее отпарсить и поместить в shared pool. Если работать дальше через binding параметров - то ето все. В чем же еще преимущества srored queries ?
User avatar
tengiz
Уже с Приветом
Posts: 4468
Joined: 21 Sep 2000 09:01
Location: Sammamish, WA

Post by tengiz »

Dmitry67 wrote:Рекурсивные квери для деревьев (слизано из Оракла :)

Nope. С ANSI/ISO SQL (читай с DB2). У Oracle нестандартная реализация.
Cheers

Return to “Вопросы и новости IT”