Documentazione Invantive
Forum di supporto InvantiveAccedi / Registrati

Espressione

caseExpression

%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    caseExpression_start((START))
    caseExpression_start --> caseExpression_0_0[CASE]
    caseExpression_0_0 --> caseExpression_0_0a[expression]
    caseExpression_0_0 --> caseExpression_0_1[caseWhenThenExpression]
    caseExpression_0_0a --> caseExpression_0_1
    caseExpression_0_1 --> caseExpression_0_2[caseElseExpression]
    caseExpression_0_2 --> caseExpression_0_3[END]
    caseExpression_0_3 --> caseExpression_end((END))

Scopo

Restituisce un'espressione, verificando in sequenza una serie di espressioni booleane per il valore true. Quando nessuna espressione booleana restituisce true, viene restituita l'espressione else.

Con un'espressione subito dopo case, la forma semplice, ogni when contiene un valore anziché una condizione, e viene presa la prima when il cui valore è uguale all'espressione: case x when 1 then 'a' when 2 then 'b' else 'c' end è case when x = 1 then 'a' when x = 2 then 'b' else 'c' end. I valori sono confrontati come li confronta l'operatore di confronto =, quindi un'espressione null o un valore null non corrisponde a nessun when e viene restituita l'espressione else, oppure null se non ce n'è una. L'espressione viene valutata per ogni when. La forma semplice è disponibile a partire dalla release 28.0.

caseWhenThenExpression

%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    caseWhenThenExpression_start((START))
    caseWhenThenExpression_start --> caseWhenThenExpression_0_0[WHEN]
    caseWhenThenExpression_0_0 --> caseWhenThenExpression_0_1[expression]
    caseWhenThenExpression_0_1 --> caseWhenThenExpression_0_2[THEN]:::quoted
    caseWhenThenExpression_0_2 --> caseWhenThenExpression_0_3[expression]
    caseWhenThenExpression_0_3 --> caseWhenThenExpression_end((END))

caseElseExpression

%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    caseElseExpression_start((START))
    caseElseExpression_start --> caseElseExpression_0_0[ELSE]
    caseElseExpression_0_0 --> caseElseExpression_0_1[expression]
    caseElseExpression_0_1 --> caseElseExpression_end((END))

castExpression

%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    castExpression_start((START))
    castExpression_start --> castExpression_0_0[CAST]
    castExpression_0_0 --> castExpression_0_1["("]
    castExpression_0_1 --> castExpression_0_2[expression]
    castExpression_0_2 --> castExpression_0_3[AS]
    castExpression_0_3 --> castExpression_0_4[sqlDataTypeExtended]
    castExpression_0_4 --> castExpression_0_5[")"]
    castExpression_0_5 --> castExpression_end((END))

Scopo

Modifica il tipo di dato di un'espressione nel tipo di dato indicato.

not

%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    Start((START)) --> not
    not -->| | NOT
    NOT --> End((END))

Scopo

Not è un operatore unario che restituisce true quando la condizione è falsa e false quando è vera. Quando la condizione è null, il risultato è null, quindi né la condizione né il suo not selezionano la riga.

è

%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    Start((START)) --> is
    is -->| | IS
    IS --> End((END))

sono

%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    Start((START)) --> are
    are -->| | ARE
    ARE --> End((END))

e

%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    Start((START)) --> and
    and -->| | AND
    AND --> End((END))

Scopo

And è un operatore binario che restituisce true quando entrambe le condizioni sono vere e false quando almeno una delle due è falsa, indipendentemente dall'altra. Altrimenti, quando uno è null e l'altro è true o null, il risultato è null: null and false è false, null and true è null. Una clausola where seleziona solo le righe per cui il risultato è true, quindi null e false vengono trattati allo stesso modo, ma in una lista di selezione, in un confronto di condizioni come (a > 0 and b > 0) = false, coalesce e is null, sono distinguibili. Fino alla release 27.0 compresa, un confronto con un valore null di una colonna e un and con un operando null restituivano false al di fuori di una clausola where.

o

%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    Start((START)) --> or
    or -->| | OR
    OR --> End((END))

Scopo

Or è un operatore binario che restituisce true quando almeno una delle due condizioni è vera, indipendentemente dall'altra, e false quando entrambe sono false. Altrimenti, quando una è null e l'altra è false o null, il risultato è null: null or true è true, null or false è null. Fino alla release 27.0 inclusa, un or con un operando null restituiva false al di fuori di una clausola where, per cui select x > 0 or y > 0 restituiva false dove x e y erano null.

vero

%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    Start((START)) --> true
    true -->| | TRUE
    TRUE --> End((END))

falso

%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    Start((START)) --> false
    false -->| | FALSE
    FALSE --> End((END))

parameterExpression

%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    parameterExpression_start((START))
    parameterExpression_start --> parameterExpression_0_0[COLON]
    parameterExpression_0_0 --> parameterExpression_0_1[identifier]
    parameterExpression_0_1 --> parameterExpression_end((END))

gt

%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    Start((START)) --> gt
    gt -->| | GT
    GT --> End((END))

Scopo

Maggiore è un operatore binario che restituisce true quando il valore di sinistra è maggiore del valore di destra. Quando uno dei due valori è null, il risultato è null. Altrimenti è false.

ge

%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    Start((START)) --> ge
    ge -->| | GE
    GE --> End((END))

Scopo

Maggiore o uguale è un operatore binario che restituisce true quando il valore di sinistra è maggiore o uguale a quello di destra. Quando uno dei due valori è null, il risultato è null. Altrimenti è false.

lt

%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    Start((START)) --> lt
    lt -->| | LT
    LT --> End((END))

Scopo

Less then è un operatore binario che restituisce true quando il valore a sinistra è minore del valore a destra. Quando uno dei due valori è null, il risultato è null. Altrimenti è false.

le

%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    Start((START)) --> le
    le -->| | LE
    LE --> End((END))

Scopo

Minore o uguale è un operatore binario che restituisce true quando il valore di sinistra è minore o uguale al valore di destra. Quando uno dei due valori è null, il risultato è null. Altrimenti è false.

eq

%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    Start((START)) --> eq
    eq -->| | EQ
    EQ --> End((END))

Scopo

Uguale è un operatore binario che restituisce true quando il valore di sinistra e quello di destra sono identici. Quando uno dei due valori è null, il risultato è null.

neq

%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    Start((START)) --> neq
    neq -->| | NEQ
    NEQ --> End((END))

Scopo

Diverso da è un operatore binario che restituisce true quando il valore di sinistra e quello di destra non sono identici. Quando uno dei due valori è null, il risultato è null.

like

%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    Start((START)) --> like
    like -->| | LIKE
    LIKE --> End((END))

Scopo

Like è un operatore che restituisce true quando il valore di sinistra corrisponde al pattern a destra. Un % nel pattern corrisponde a una sequenza di zero, uno o più caratteri, mentre un _ corrisponde esattamente a un carattere. Senza escape, ogni % e _ nel pattern è un carattere jolly.

Con escape seguito da un testo di esattamente un carattere, quel carattere fa sì che il %, il _ o il carattere di escape che lo segue valgano come se stessi: code like 'A!_%' escape '!' seleziona i codici che iniziano con A_, e '10%' like '10!%' escape '!' è true. Un carattere di escape seguito da qualsiasi altro carattere, o alla fine del pattern, genera itgensql921. Un escape che non sia lungo esattamente un carattere genera itgensql920, e un pattern che non sia un testo genera itgensql922. La clausola escape è disponibile a partire dalla release 28.0.

Quando il valore, il pattern o l'escape è null, né like né not like è vero, quindi nessuno dei due seleziona la riga. Fino alla release 27.0 compresa, not like senza escape poteva selezionare le righe con valore null, a seconda della piattaforma.

Un like o not like con escape il cui pattern è una costante senza % o _ escapato viene passato alla piattaforma come lo stesso like o not like senza caratteri di escape, e come uguaglianza quando il pattern non contiene alcun carattere jolly. Per un like il cui pattern contiene un % o _ escaped, la piattaforma riceve un like più ampio in cui ogni % o _ escaped è sostituito da _; Invantive UniversalSQL poi rimuove le righe che non corrispondono esattamente, e un delete o update con tale condizione viene eseguito riga per riga. Un not like con un % o _ escapato viene valutato da Invantive UniversalSQL stesso, quindi tutte le righe selezionate dalle altre condizioni vengono prima recuperate dalla piattaforma.

Esempi

L'esempio seguente seleziona i codici che iniziano con A_; senza escape il pattern 'A_%' selezionerebbe anche AB1 e A%2:

select cde.code
from   ( select 'A_1' code from dual@datadictionary
         union all
         select 'AB1' code from dual@datadictionary
         union all
         select 'A%2' code from dual@datadictionary
       ) cde
where  cde.code like 'A!_%' escape '!'

code
----
A_1

between

%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    Start((START)) --> between
    between -->| | BETWEEN
    BETWEEN --> End((END))

Scopo

Between è un operatore ternario che restituisce true quando il valore di sinistra è compreso tra il secondo e il terzo valore, estremi inclusi: x between a and b equivale a x >= a and x <= b. Quando il valore di sinistra è null, il risultato è null. Quando un limite è null, il risultato è null, a meno che l'altro limite non lo determini già: 5 between null and 3 è false, quindi 5 not between null and 3 è true. I testi vengono confrontati in base al codice di ciascun carattere (ordinale), come in order by. Fino alla release 27.0.79 compresa, not between con un limite null poteva selezionare altre righe.

in_

%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    Start((START)) --> in_
    in_ -->| | IN
    IN --> End((END))

Scopo

In è un operatore n-ario che restituisce true quando il valore a sinistra è uno dei valori a destra dopo 'in'. Quando il valore di sinistra è null, oppure quando nessun valore corrisponde e uno dei valori è null, il risultato è null, quindi né in né not in seleziona la riga: 1 not in (2, null) è null. Fino alla release 27.0.79 inclusa, not in con un null tra i valori poteva selezionare la riga.

Quando non ci sono affatto valori, cosa che accade quando una sottoquery non restituisce righe, in è false e not in è true, anche quando il valore di sinistra è null: non c'è alcun valore a cui essere diverso. Fino alla release 27.0.79 inclusa, not in con un valore di sinistra null rispetto a una sottoquery correlata che non ha restituito righe poteva invece rispondere null, ad esempio all'interno di un case o sotto un or.

Esempi

Il seguente esempio seleziona ogni dipendente, perché la sottoquery non restituisce righe; viene selezionato anche il dipendente senza reparto:

select emp.code
from   ( select 'A100' code, 'SLS' dept
         union all
         select 'A200' code, null dept
       ) emp
where  emp.dept not in ( select dpt.dept
                         from   ( select 'ENG' dept
                                ) dpt
                         where  dpt.dept = 'FIN'
                       )

code
----
A100
A200

expression

%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart TD
    expression_start((START))
    expression_start --> expression_0_0[minus]
    expression_0_0 --> expression_0_1[plus]
    expression_0_1 --> expression_0_2[not]
    expression_0_2 --> expression_0_3[expression]
    expression_0_3 --> expression_end((END))
    expression_start --> expression_1_0[expression]
    expression_1_0 --> expression_1_1[concat]
    expression_1_1 --> expression_1_2[times]
    expression_1_2 --> expression_1_3[divide]
    expression_1_3 --> expression_1_4[plus]
    expression_1_4 --> expression_1_5[minus]
    expression_1_5 --> expression_1_6[gt]
    expression_1_6 --> expression_1_7[ge]
    expression_1_7 --> expression_1_8[lt]
    expression_1_8 --> expression_1_9[le]
    expression_1_9 --> expression_1_10[eq]
    expression_1_10 --> expression_1_11[neq]
    expression_1_11 --> expression_1_12[and]
    expression_1_12 --> expression_1_13[or]
    expression_1_13 --> expression_1_14[expression]
    expression_1_14 --> expression_1_15[not]
    expression_1_15 --> expression_1_16[like]
    expression_1_16 --> expression_1_17[between]
    expression_1_17 --> expression_1_18[expression]
    expression_1_18 --> expression_1_19[and]
    expression_1_19 --> expression_1_20[expression]
    expression_1_20 --> expression_1_21[in_]
    expression_1_21 --> expression_1_22["("]
    expression_1_22 --> expression_1_23[expression]
    expression_1_23 --> expression_1_24[","]:::quoted
    expression_1_24 --> expression_1_25[expression]
    expression_1_25 --> expression_1_26[selectStatement]
    expression_1_26 --> expression_1_27[")"]
    expression_1_27 --> expression_1_28[is]
    expression_1_28 --> expression_1_29[not]
    expression_1_29 --> expression_1_30[NULL]
    expression_1_30 --> expression_end((END))
    expression_start --> expression_2_0[not]
    expression_2_0 --> expression_2_1[exists]
    expression_2_1 --> expression_2_2["("]
    expression_2_2 --> expression_2_3[selectStatement]
    expression_2_3 --> expression_2_4["("]
    expression_2_4 --> expression_2_5[selectStatement]
    expression_2_5 --> expression_2_6[expression]
    expression_2_6 --> expression_2_7[")"]
    expression_2_7 --> expression_end((END))
    expression_start --> expression_3_0[constantExpression]
    expression_3_0 --> expression_end((END))
    expression_start --> expression_4_0[functionExpression]
    expression_4_0 --> expression_end((END))
    expression_start --> expression_5_0[parameterExpression]
    expression_5_0 --> expression_end((END))
    expression_start --> expression_6_0[triggerRecordVariableExpression]
    expression_6_0 --> expression_end((END))
    expression_start --> expression_7_0[castExpression]
    expression_7_0 --> expression_end((END))
    expression_start --> expression_8_0[caseExpression]
    expression_8_0 --> expression_end((END))
    expression_start --> expression_9_0[arrayExpression]
    expression_9_0 --> expression_end((END))
    expression_start --> expression_10_0[pSqlCallProcedureStatementNS]
    expression_10_0 --> expression_end((END))
    expression_start --> expression_11_0[fieldIdentifier]
    expression_11_0 --> expression_end((END))
    expression_start --> expression_12_0[bindVariable]
    expression_12_0 --> expression_end((END))
    expression_start --> expression_13_0[aggregateFunction]
    expression_13_0 --> expression_end((END))

bindVariable

%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    Start((START)) --> bindVariable
    bindVariable -->| | BIND_VARIABLE
    BIND_VARIABLE --> End((END))

arrayExpression

%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    arrayExpression_start((START))
    arrayExpression_start --> arrayExpression_0_0[ARRAY_OPEN]
    arrayExpression_0_0 --> arrayExpression_0_1[expression]
    arrayExpression_0_1 --> arrayExpression_0_2[","]:::quoted
    arrayExpression_0_2 --> arrayExpression_0_3[expression]
    arrayExpression_0_3 --> arrayExpression_0_4[ARRAY_CLOSE]
    arrayExpression_0_4 --> arrayExpression_end((END))

functionExpression

Un functionExpression è una delle seguenti funzioni SQL:

LIST
WHERE file.folder = "Invantive UniversalSQL/Grammar/SQL Functions"
AND file.name != this.file.name
SORT file.name ASC

divide

%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    Start((START)) --> divide
    divide -->| | DIVIDE
    DIVIDE --> End((END))

Scopo

Divide un numero per il secondo numero.

Parametri:

  • first: un numero da dividere.
  • second: un numero per cui dividere.

Restituisce: il risultato della divisione.

exists

%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    Start((START)) --> exists
    exists -->| | EXISTS
    EXISTS --> End((END))

ln

%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    Start((START)) --> ln
    ln -->| | LN
    LN --> End((END))

Scopo

La funzione LN restituisce il logaritmo naturale di un numero.

Parametri:

  • Input: un numero di cui calcolare il logaritmo naturale.

Restituisce: il logaritmo naturale del valore immesso.

minus

%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    Start((START)) --> minus
    minus -->| | MINUS
    MINUS --> End((END))

Scopo

La funzione MINUS sottrae un valore da un altro.

Parametri:

  • Valore: un numero o una data e ora.
  • Sottrai: un numero o una data e ora.

Restituisce: il valore meno la sottrazione.

più

%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    Start((START)) --> plus
    plus -->| | PLUS
    PLUS --> End((END))

Scopo

La funzione PLUS aggiunge un valore a un altro.

Parametri:

  • Valore: un numero o una data e ora.
  • add: un numero o un datetime.

Restituisce: un nuovo valore con entrambi i valori sommati tra loro.

times

%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    Start((START)) --> times
    times -->| | ASTERIX
    ASTERIX --> End((END))

Scopo

La funzione TIMES moltiplica un numero per il secondo numero.

Parametri:

  • First: un numero da moltiplicare.
  • Secondo: un numero per cui moltiplicare.

Restituisce: il primo numero moltiplicato per il secondo numero.

constantExpression

%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    Start((START)) --> constantExpression
    constantExpression -->| | stringLiteral
    stringLiteral --> End((END))
    constantExpression -->| | numericConstant
    numericConstant --> End((END))
    constantExpression -->| | booleanConstant
    booleanConstant --> End((END))
    constantExpression -->| | intervalConstant
    intervalConstant --> End((END))
    constantExpression -->| | datetimeLiteral
    datetimeLiteral --> End((END))
    constantExpression -->| | null
    null --> End((END))

stringConstant

%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    stringConstant_start((START))
    stringConstant_start --> stringConstant_0_0[stringOrChar]
    stringConstant_0_0 --> stringConstant_0_1[CONCAT_OP]
    stringConstant_0_1 --> stringConstant_0_2[stringOrChar]
    stringConstant_0_2 --> stringConstant_end((END))

Scopo

Un valore di testo costante di tipo varchar2, composto da uno o più letterali uniti da ||. Usato dove un'istruzione richiede una costante, come un'etichetta, un nome o un delimitatore.

stringLiteral

%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    Start((START)) --> stringOrChar
    stringOrChar --> End((END))

Scopo

Un singolo letterale di testo all'interno di un'espressione. I letterali uniti da || in un'espressione formano una concatenazione e producono lo stesso valore della costante composta da quei letterali: 'a' || 'b' è 'ab', e '' || '' è null. Una concatenazione conta un livello per ogni || ai fini della massima annidazione di un'istruzione, quindi una singola espressione unisce al massimo circa 990 letterali; una più lunga viene rifiutata con itgendid801.

stringOrChar

%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    Start((START)) --> STRING_C
    STRING_C --> parenthesisOpen
    parenthesisOpen --> INT_OR_DECIMAL_C
    INT_OR_DECIMAL_C --> parenthesisClose
    parenthesisClose --> STRING_C
    STRING_C --> End((END))

intervalConstant

%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    intervalConstant_start((START))
    intervalConstant_start --> intervalConstant_0_0[INTERVAL]
    intervalConstant_0_0 --> intervalConstant_0_1[stringConstant]
    intervalConstant_0_1 --> intervalConstant_end((END))

Scopo

Un valore di intervallo costante, che riflette la durata tra due date. La costante di testo consiste in un numero intero e in un'unità di tempo, scelta dal seguente elenco:

  • Millisecond,
  • secondo,
  • minuto,
  • hour,
  • day,
  • week, and
  • anno.

Le unità possono essere seguite da una 's' senza cambiare il significato, come 'years'.

Valori di intervallo validi sono ad esempio: "5 secondi", "20 ore" e "1 anno". Non è supportato un intervallo combinato come "30 minuti e 30 secondi".

datetimeLiteral

%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    datetimeLiteral_start((START))
    datetimeLiteral_start --> datetimeLiteral_0_0[DATE]:::quoted
    datetimeLiteral_start --> datetimeLiteral_0_0a[TIME]:::quoted
    datetimeLiteral_start --> datetimeLiteral_0_0b[TIMESTAMP]:::quoted
    datetimeLiteral_0_0 --> datetimeLiteral_0_1[stringLiteral]
    datetimeLiteral_0_0a --> datetimeLiteral_0_1
    datetimeLiteral_0_0b --> datetimeLiteral_0_1
    datetimeLiteral_0_1 --> datetimeLiteral_end((END))

Scopo

Una costante data, ora o timestamp nella notazione dello standard SQL, che ha lo stesso significato in ogni lingua e cultura: date '2026-08-13', time '12:34:56' o timestamp '2026-08-13 12:34:56.123456'. Una data si scrive come YYYY-MM-DD, un orario come HH24:MI:SS e un timestamp come YYYY-MM-DD HH24:MI:SS; i secondi possono avere fino a sette decimali, e un timestamp senza ora del giorno corrisponde alla mezzanotte. Un testo in qualsiasi altra notazione, oppure una data che non esiste come date '2026-02-30', genera un errore. Il valore è uguale a quello che dà un cast del testo, come cast('2026-08-13' as date). Disponibile a partire dalla versione 28.0.

numericConstant

%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    Start((START)) --> numericConstant
    numericConstant -->| | INT_OR_DECIMAL_C
    INT_OR_DECIMAL_C --> End((END))
    numericConstant -->| | E_NOTATION_C
    E_NOTATION_C --> End((END))

Scopo

Una costante numerica con tipo di dato numerico.

booleanConstant

%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    Start((START)) --> booleanConstant
    booleanConstant -->| | true
    true --> End((END))
    booleanConstant -->| | false
    false --> End((END))