Skip to main content

Overview

Updates all fields of an existing payroll concept in tab_conceptos.

Signature

fun_update_conceptos(
    wid_concepto INTEGER,
    new_nom_concepto VARCHAR,
    new_ind_operacion BOOLEAN,
    new_ind_perio_pago CHAR(1),
    new_neto_pagado BOOLEAN,
    new_val_porcent NUMERIC,
    new_val_fijo NUMERIC,
    new_ind_legal BOOLEAN
) RETURNS BOOLEAN

Parameters

wid_concepto
INTEGER
required
Concept ID to update
new_nom_concepto
VARCHAR
required
New concept name (minimum 5 characters)
new_ind_operacion
BOOLEAN
required
New operation indicator
new_ind_perio_pago
CHAR(1)
required
New payment period: ‘Q’ or ‘M’
new_neto_pagado
BOOLEAN
required
New net payment indicator
new_val_porcent
NUMERIC
required
New percentage value
new_val_fijo
NUMERIC
required
New fixed value
New legal indicator

Returns

  • TRUE - Concept updated successfully
  • FALSE - Update failed

Example Usage

-- Update a concept
SELECT fun_update_conceptos(
    2,
    'nombre cambiado del concepto 2',
    FALSE,
    'Q',
    TRUE,
    0,
    1067625,
    TRUE
);

Validation Rules

  • Concept ID must exist
  • Concept name must be at least 5 characters
  • Payment period must be ‘Q’ or ‘M’
  • Percentage value must be between 0 and 100

Error Handling

SQL StateDescription
23503Foreign key does not exist
23505Unique constraint violation
23514Value violates table constraints
22001Value exceeds allowed length
22P02Invalid data type
othersUnknown error

Source

source/func/conceptos/fun_update_conceptos.sql

Build docs developers (and LLMs) love