开发者

Setting the value of a form field from a Query

I have a form field where one of the values has a default value defin开发者_开发知识库ed in a an application settings table. The user would see the default value upon display of the create form, but could change it to another value if they wanted prior to saving the new row.

I don't see any way in the field defaults to specify that the default value is the result of an SQL query (e.g. select default_rate from app_defaults where row_key = 1).

Surely this has to be possible, but how?


As posted to Jeffrey above, final solution can be done completely within APEX but using the Default Value Type = PL/SQL Function Body on the page item.

DECLARE default_value number(9,2); 
BEGIN 
SELECT deflt_rate INTO default_value FROM app_defaults WHERE row_key = 1; 
RETURN default_value; 
END;


You can use the SQL query in a PL/SQL block to assign it directly, e.g.

SELECT default_rate
INTO :myblock.rate
FROM app_defaults
WHERE row_key = 1;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜