invantive-dokumentationen del af invantive cloud
Invantive Support ForumsLog ind / Tilmeld dig

Create or Replace PSQL-objekt

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))

Formål

Create function-sætningen opretter en PSQL-blok, der udfører koden og returnerer en værdi til kalderen ved hjælp af 'return'-sætningen. Der rejses en fejl, hvis en funktion, procedure eller pakke med samme navn allerede findes. Når 'or replace' angives, slettes en eksisterende funktion med samme navn, før den nye funktion oprettes.

Når replace-klausulen bruges, erstattes en tidligere version af den identisk navngivne funktion. Ellers rejses en fejl, hvis en funktion med samme navn allerede findes. Når if not exists-klausulen bruges (tilgængelig fra 25.0.41 og 24.0.778), oprettes funktionen kun, hvis en tidligere version af den identisk navngivne funktion ikke fandtes.

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))

Formål

Create function-sætningen opretter en PSQL-blok, der udfører kode, når den kaldes. Der rejses en fejl, hvis en funktion, procedure eller pakke med samme navn allerede findes. Når 'or replace' angives, slettes en eksisterende procedure med samme navn, før den nye procedure oprettes.

Når replace-klausulen bruges, erstattes en tidligere version af den identisk navngivne procedure. Ellers rejses en fejl, hvis en procedure med samme navn allerede findes. Når if not exists-klausulen bruges (tilgængelig fra 25.0.41 og 24.0.778), oprettes proceduren kun, hvis en tidligere version af den identisk navngivne procedure ikke fandtes.

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))