Skip to main content

Overview

Inserts a new payroll concept into tab_conceptos with calculation rules and payment settings.

Signature

fun_insert_conceptos(
    wnom_concepto VARCHAR,
    wind_operacion BOOLEAN,
    wind_perio_pago CHAR(1),
    wneto_pagado BOOLEAN,
    wval_porcent NUMERIC,
    wval_fijo NUMERIC,
    wind_legal BOOLEAN
) RETURNS BOOLEAN

Parameters

wnom_concepto
VARCHAR
required
Concept name (minimum 5 characters)
wind_operacion
BOOLEAN
required
Operation indicator (TRUE for addition, FALSE for subtraction)
wind_perio_pago
CHAR(1)
required
Payment period: ‘Q’ (quincenal/biweekly) or ‘M’ (mensual/monthly)
wneto_pagado
BOOLEAN
required
Indicates if concept affects net payment
wval_porcent
NUMERIC
required
Percentage value (0-100)
wval_fijo
NUMERIC
required
Fixed value amount
Indicates if concept is legally mandated

Returns

  • TRUE - Concept inserted successfully
  • FALSE - Insert failed

Example Usage

-- Insert a new concept
SELECT fun_insert_conceptos(
    'concepto3',
    FALSE,
    'Q',
    TRUE,
    0,
    1067625,
    TRUE
);

-- Insert a percentage-based deduction
SELECT fun_insert_conceptos(
    'Health Insurance',
    FALSE,
    'M',
    TRUE,
    4,
    0,
    TRUE
);

Validation Rules

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

Error Handling

SQL StateDescription
23505NULL value in ID field
23514Value violates check constraint
othersUnknown error during insert

Source

source/func/conceptos/fun_insert_conceptos.sql

Build docs developers (and LLMs) love