Oracle Autonomous Database (ADB) continues to evolve rapidly with
new capabilities that make data access more flexible, secure, and
developer-friendly. One such recent enhancement is the ability to use bind variables in SQL queries within Table Hyperlinks (also known as Pre-Authenticated URLs).
This feature allows you to define
SQL queries that include bind variables and then supply values for those
variables either:
·
As default bind values
at the time of hyperlink creation, or
·
As runtime URL parameters
when calling the link.
This makes Pre-Authenticated URLs even more powerful, especially
when building dashboards, external integrations, or lightweight query-driven
APIs that depend on dynamic filtering.
In this
article, we’ll walk through:
1. What
this feature is and why it’s useful
2. How
to create a Pre-Authenticated URL using bind variables
3. How
default bind values behave
4. How
to override bind values at runtime using query parameters
Previously, Table Hyperlinks supported only static SQL statements,
which meant:
·
The logic was fixed
·
Filtering required separate hyperlinks
·
External services had no way to pass in parameters dynamically
With this enhancement, you can now create one hyperlink and
let clients supply any number of dynamic bind values at runtime. This
reduces maintenance, improves flexibility, and allows Table Hyperlinks to
behave more like parameterized REST endpoints — without needing to implement a
full REST service.
Creating a Table Hyperlink With Bind Variables
2 l_status long;
3 begin
4 dbms_data_access.create_url(
5 sql_statement => q'# select * from emp where deptno = :b1 and job = :b2 #'
6 , service_name =>'LOW'
7 , default_bind_values => json_object('b1' value 20 ,'b2' value 'CLERK')
8 , result => l_status );
9 dbms_output.put_line( l_status );
10 end;
11 /
The key points here:
·
The SQL contains bind variables (:b1, :b2).
·
default_bind_values
defines values that will be used if no runtime parameters are supplied.
·
A new pre-authenticated URL gets generated.
"status" : "SUCCESS",
"id" : "gTqfJcv0JfckskdR7eI77QCUrMcMe5N4k1iXeeWstlo6c7uKxXQbyQQPotFTi10E",
"preauth_url" : "https://dataaccess.adb.us-ashburn-1.oraclecloudapps.com/adb/p/SSi8uslpyP4hikoPvJedQ9K6Jd-jGfC4hgY-tvdWWrqeu9TP_kPYoVkBu31kHadXqC3rdDDU4j4/data",
"expiration_ts" : "2026-02-19T14:58:18.187Z"
}
Accessing the Hyperlink Without Runtime Parameters
All you need to do is append query parameters to the URL, using the same bind variable names.
1.
Changing a Single Bind Variable
{
"items": [
{
"EMPNO":
7934,
"ENAME":
"MILLER",
"JOB":
"CLERK",
"MGR":
7782,
"HIREDATE": "1982-01-23T00:00:00",
"SAL":
1300,
"DEPTNO":
10
}
],
"hasMore":
false,
"limit": 1000,
"offset": 0,
"count": 1,
"links": [
{
"rel":
"self",
"href":
"https://dataaccess.adb.us-ashburn-1.oraclecloudapps.com/adb/p/SSi8uslpyP4hikoPvJedQ9K6Jd-jGfC4hgY-tvdWWrqeu9TP_kPYoVkBu31kHadXqC3rdDDU4j4/data?b1=10"
}
]
}
'CLERK' because we did not
override b2.$ curl --location
'https://dataaccess.adb.us-ashburn-1.oraclecloudapps.com/adb/p/SSi8uslpyP4hikoPvJedQ9K6Jd-jGfC4hgY-tvdWWrqeu9TP_kPYoVkBu31kHadXqC3rdDDU4j4/data?b1=20&b2=MANAGER'
{
"items": [
{
"EMPNO":
7566,
"ENAME":
"JONES",
"JOB":
"MANAGER",
"MGR":
7839,
"HIREDATE": "1981-04-02T00:00:00",
"SAL":
2975,
"DEPTNO":
20
}
],
"hasMore":
false,
"limit": 1000,
"offset": 0,
"count": 1,
"links": [
{
"rel":
"self",
"href":
"https://dataaccess.adb.us-ashburn-1.oraclecloudapps.com/adb/p/SSi8uslpyP4hikoPvJedQ9K6Jd-jGfC4hgY-tvdWWrqeu9TP_kPYoVkBu31kHadXqC3rdDDU4j4/data?b1=20&b2=MANAGER"
}
]
}
This enhancement opens the door for several
powerful scenarios:
·
Dynamic filtering
for dashboards
o Single URL can drive
multiple filtered views
·
External system
integrations
o Supply parameters
from REST clients without changing SQL
·
Lightweight report
endpoints
o Customize responses
without creating multiple URLs
·
Secure parameterized
access
o Bind variables
reduce SQL injection risks
·
Simplified API behaviour
o Acts like a
parameterized GET endpoint
If you're building
applications that need controlled, query-based access to ADB data, this feature
dramatically reduces overhead.
Bind variable
support for Table Hyperlinks adds a powerful new dimension to how data can be
accessed and filtered in Autonomous Database. With just one hyperlink, you can:
·
Define parameterized
SQL
·
Provide default bind
values
·
Override those
values at runtime
·
Drive flexible,
dynamic data retrieval from external systems
This makes
Pre-Authenticated URLs a versatile tool for lightweight data APIs, automated
pipelines, and integration workflows.
No comments:
Post a Comment