Invantive-Dokumentation
Invantive SupportforenAnmelden / Eintragen

PSQL-Objekt erstellen oder ersetzen

pSqlCreateFunction

%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    pSqlCreateFunction_start((START))
    pSqlCreateFunction_start --> pSqlCreateFunction_0_0[CREATE]:::quoted
    pSqlCreateFunction_0_0 --> pSqlCreateFunction_0_1[OR]:::quoted
    pSqlCreateFunction_0_1 --> pSqlCreateFunction_0_2[REPLACE]:::quoted
    pSqlCreateFunction_0_2 --> pSqlCreateFunction_0_3[pSqlFunctionSpec]
    pSqlCreateFunction_0_3 --> pSqlCreateFunction_end((END))

Anwendung

Das Statement create function erstellt einen PSQL-Block, der den Code ausführt und mithilfe der Anweisung return einen Wert an den Aufrufer zurückgibt. Es wird ein Fehler ausgelöst, wenn bereits eine Funktion, Prozedur oder ein Paket mit demselben Namen existiert. Wenn „or replace“ angegeben wird, wird eine bereits vorhandene Funktion mit demselben Namen vor dem Anlegen der neuen Funktion gelöscht.

Bei Verwendung der „REPLACE“-Klausel wird eine frühere Version der gleichnamigen Funktion ersetzt. Andernfalls wird ein Fehler ausgelöst, wenn bereits eine Funktion mit demselben Namen existiert. Bei Verwendung der „if not exists“-Klausel (verfügbar ab 25.0.41 und 24.0.778) wird die Funktion nur angelegt, wenn keine frühere Version der gleichnamigen Funktion existierte.

pSqlCreateProcedure

%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    pSqlCreateProcedure_start((START))
    pSqlCreateProcedure_start --> pSqlCreateProcedure_0_0[CREATE]:::quoted
    pSqlCreateProcedure_0_0 --> pSqlCreateProcedure_0_1[OR]:::quoted
    pSqlCreateProcedure_0_1 --> pSqlCreateProcedure_0_2[REPLACE]:::quoted
    pSqlCreateProcedure_0_2 --> pSqlCreateProcedure_0_3[pSqlProcedureSpec]
    pSqlCreateProcedure_0_3 --> pSqlCreateProcedure_end((END))

Anwendung

Das Statement create function erstellt einen PSQL-Block, der bei Aufruf den Code ausführt. Es wird ein Fehler ausgelöst, wenn bereits eine Funktion, Prozedur oder ein Paket mit demselben Namen existiert. Wenn „or replace“ angegeben wird, wird eine bereits vorhandene Prozedur mit demselben Namen gelöscht, bevor die neue Prozedur angelegt wird.

Bei Verwendung der „replace“-Klausel wird eine frühere Version der gleichnamigen Prozedur ersetzt. Andernfalls wird ein Fehler ausgelöst, wenn bereits eine Prozedur mit demselben Namen existiert. Bei Verwendung der „if not exists“-Klausel (verfügbar ab 25.0.41 und 24.0.778) wird die Prozedur nur angelegt, wenn keine frühere Version der gleichnamigen Prozedur existierte.

pSqlFunctionSpec

%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart TD
    pSqlFunctionSpec_start((START))
    pSqlFunctionSpec_start --> pSqlFunctionSpec_0_0[FUNCTION]:::quoted
    pSqlFunctionSpec_0_0 --> pSqlFunctionSpec_0_1[pSqlVariableName]
    pSqlFunctionSpec_0_1 --> pSqlFunctionSpec_0_2["("]:::quoted
    pSqlFunctionSpec_0_2 --> pSqlFunctionSpec_0_3[pSqlArgumentList]
    pSqlFunctionSpec_0_3 --> pSqlFunctionSpec_0_4[")"]:::quoted
    pSqlFunctionSpec_0_4 --> pSqlFunctionSpec_0_5[RETURN]:::quoted
    pSqlFunctionSpec_0_5 --> pSqlFunctionSpec_0_6[pSqlDataType]
    pSqlFunctionSpec_0_6 --> pSqlFunctionSpec_0_7[AS]:::quoted
    pSqlFunctionSpec_0_7 --> pSqlFunctionSpec_0_8[IS]:::quoted
    pSqlFunctionSpec_0_8 --> pSqlFunctionSpec_0_9[pSqlBlockOptionalDeclare]
    pSqlFunctionSpec_0_9 --> pSqlFunctionSpec_end((END))

pSqlProcedureSpec

%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart TD
    pSqlProcedureSpec_start((START))
    pSqlProcedureSpec_start --> pSqlProcedureSpec_0_0[PROCEDURE]:::quoted
    pSqlProcedureSpec_0_0 --> pSqlProcedureSpec_0_1[pSqlVariableName]
    pSqlProcedureSpec_0_1 --> pSqlProcedureSpec_0_2["("]:::quoted
    pSqlProcedureSpec_0_2 --> pSqlProcedureSpec_0_3[pSqlArgumentList]
    pSqlProcedureSpec_0_3 --> pSqlProcedureSpec_0_4[")"]:::quoted
    pSqlProcedureSpec_0_4 --> pSqlProcedureSpec_0_5[AS]:::quoted
    pSqlProcedureSpec_0_5 --> pSqlProcedureSpec_0_6[IS]:::quoted
    pSqlProcedureSpec_0_6 --> pSqlProcedureSpec_0_7[pSqlBlockOptionalDeclare]
    pSqlProcedureSpec_0_7 --> pSqlProcedureSpec_end((END))