0

When I get a field, this work good.

But, when get a field from a 'VIEW', is a problem because the code of a VIEW is:

CREATE OR REPLACE VIEW tabla_clientes AS
SELECT id_cliente,nombre, CONCAT('$ ',FORMAT(monto_a_favor,0), '???'), CONCAT('$ ',FORMAT(calcular_monto_por_cobrar_cliente(id_cliente),0)) 
FROM cliente;

When I compile this. Appears errors from the name of fields.

Description                                            |  Object
----------------------------------------------------------------------------
Syntax error, insert ";" to complete BlockStatements   | ${CONCAT('$ ',FORMAT(monto_a_favor,0)}
Syntax error on tokens, delete these tokens            | ${CONCAT('$ ',FORMAT(monto_a_favor,0)}
Syntax error on token ",", delete this token           | ${CONCAT('$ ',FORMAT(monto_a_favor,0)}

If I change the name at this field appears other error.

4

1 回答 1

0

我解决这个..

在每个字段后使用 ALIAS :

CREATE OR REPLACE VIEW tabla_clientes AS
SELECT id_cliente,nombre AS id_cliente, CONCAT('$ ',FORMAT(monto_a_favor,0), '???') AS monto_favor, CONCAT('$ ',FORMAT(calcular_monto_por_cobrar_cliente(id_cliente),0)) AS monto_calculado 
FROM cliente;

我从 Alias 中调用这些字段。

于 2013-06-27T22:19:07.223 回答