如何在Oracle ApEx中的Javascript中访问Oracle数据库表列数据 [英] How to Access Oracle Database Table Column Data within Javascript in Oracle ApEx
问题描述
我在数据库表中有一列,其中包含几个URL,我想知道什么是将这些URL从数据库表转换为javascript函数的最佳方法.
I have a column in a database table that contains several urls and I was wondering what is the best way to get these urls from the database table into a javascript function.
将非常感谢您了解如何实现此目的的示例代码.
Example code of how to approach this would be much appreciated.
谢谢.
推荐答案
如果您可以通过PL/SQL代码将URL放入页面项中,则可以像这样从Javascript访问页面项值:
If you can get the URLs into page items via PL/SQL code then you can access the page item values from Javascript like this:
url1 = $v('P1_URL1');
url2 = $v('P1_URL2');
例如,您可能有一个类似PL/SQL的加载过程:
For example, you could have an on-load PL/SQL process like:
select url1, url2
into :p1_url1, :p1_url2
from my_urls
where ...;
要将多个URL放入数组中,可以使用此示例.同样,这将是PL/SQL代码,用于将JSON数组放入一个页面项中,然后您可以使用v $()从Javascript访问该页面项.或者,您可以在此处
To put several URLs into an array you could use the PL/JSON library - see this example. Again, this would be PL/SQL code to put the JSON array into a page item which you can then access from Javascript using v$(). Or you could use AJAX as descrobed here.
这篇关于如何在Oracle ApEx中的Javascript中访问Oracle数据库表列数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!