- SYS.DBMS_DEBUG_VC2COLL is a handy pre-defined TABLE OF VARCHAR2(1000)
- SYS.KU$_VCNT is TABLE OF VARCHAR2(4000)
Both are granted to public.
Thanks to Eddie Awad's blog for these.
Some very occasional musings on matters concerning Oracle specifically or databases in general.
Applications can be translated from a primary language into other languages. Each translation results in the creation of a new translated application. Each translation requires a mapping which identifies the target language as well as the translated application ID. Translated applications cannot be edited directly in the Application Builder.I have never used this method, but I have worked on a number of APEX applications that can be translated into other languages by other means. Essentially this is a matter of "soft-coding" all boilerplate such as region titles and item labels - holding them as data in tables and selecting the appropriate values at run time.
Once the translation mappings are established the translatable text within the application is seeded into a translation repository. This repository can then be exported to an XLIFF for translation.
Once the XLIFF file is populated with the translations, one file per language, the XLIFF file is uploaded back into the translation repository. The final step is to publish each translated application from the translation repository.
A translated application will require synchronization when the primary application has been modified since the translated version was last published. Even modifications to application logic will require synchronization. To synchronize, seed and publish the translated application.
| APP_ID | ITEM_NAME | LANGUAGE | LABEL_TEXT |
|---|---|---|---|
| 101 | P1_EMPNO | ENG | Employee identifier |
| 101 | P1_EMPNO | ES | Identificación del empleado |
| 101 | P1_EMPNO | FR | Identifiant des employés |
function label_text (p_app_id number,
p_item_name varchar2,
p_language varchar2)
<label for="#CURRENT_ITEM_NAME#">"LABEL_TEXT""LABEL_TEXT" is a reference to an APEX shortcut which we can now define using PL/SQL function body:
return translate_pkg.label_text(:APP_ALIAS,'#CURRENT_ITEM_NAME#',:AI_LANGUAGE)(AI_LANGUAGE is an application item defining the user's preferred language.) All we now need to do is use the new label template on all our page items and leave the item's label attribute blank.
<items>
<item type="editor" node="TableNode" vertical="true">
<title><![CDATA[Child Tables]]></title>
<query>
<sql><![CDATA[select cons.table_name, cons.constraint_name
from all_constraints cons
where cons.constraint_type = 'R'
and (cons.r_constraint_name, cons.r_owner) in
(select pk.constraint_name, pk.owner
from all_constraints pk
where owner = :OBJECT_OWNER
and table_name = :OBJECT_NAME
and constraint_type in ('P','U'))]]>
</sql>
</query>
</item>
</items>
<items>
<item type="editor" node="ViewNode" vertical="true">
<title><![CDATA[ERRORS]]></title>
<query>
<sql><![CDATA[SELECT
ATTRIBUTE, LINE
|| ':'
||POSITION "LINE:POSITION", TEXT
FROM
All_Errors
WHERE
type = 'VIEW'
AND owner = :OBJECT_OWNER
AND name = :OBJECT_NAME
ORDER BY
SEQUENCE ASC
]]></sql>
</query>
</item>
</items>
(Update 2019: SQL Developer now includes an Errors tab for views already, so this is redundant.)
procedure do_something (p_empno in number)
is
l_empno number;
l_boss_ind varchar2(1) := 'N';
cursor c_emp (cp_empno number) is
select job
from emp
where empno = cp_empno;
begin
for rec in c_emp (l_empno) loop
if rec.job = 'MANAGER' then
l_boss_ind = 'Y';
end if;
end loop;
insert into some_table (empno, boss_ind) values (p_empno, l_boss_ind);
end;


"At Northgate Revenues & Benefits, we have used APEX to replace our legacy Oracle Forms system comprising around 1500 Forms. Our user interface has 10,000 end users daily, across 172 clients, who this year sent out over 12 million Council Tax annual bills worth £15billion and will pay out benefits of over £13billion. Our clients now experience, on average, sub second response times across a working day. We are continuing to leverage our investment in Oracle Application Express by delivering citizen facing solutions as well as launching the conversion of our Social Housing application which will replace 3,500 Oracle Forms running at 100 clients worldwide, with a total of 15,000 end users managing circa 3,000,000 properties. Oracle Application Express has helped us to make the move away from Oracle Forms whilst delivering benefits to our clients and our business.."
-- Alan Powell, Director of Products and Services, Northgate Public Services
1) End of range A overlaps start of range B:This leads to SQL like this (assuming all values are not null):
A----
B---------
2) Start of range A overlaps end of range B:
A--------
B----
3) Range A falls entirely within range B:
A---
B--------------
4) Range B falls entirely within range A:
A--------------
B---
where (a.start < b.startIf, as is often the case, the end dates are allowed to be null, meaning "forever", then the SQL becomes yet more complex. In some cases I have seen attempts at this where the developer has got it wrong and missed out one of the cases altogether.
and a.end between b.start and b.end)
or (a.start between b.start
and b.end and a.end > b.end)
or (a.start between b.start and b.end
and a.end between b.start and b.end)
or (b.start between a.start and a.end
and b.end between a.start and a.end)
1) Range A ends before range B starts:This leads to the much simpler SQL:
A---
B-----
2) Range A starts after range B ends:
A-----
B---
where not (a.end < b.start or a.start > b.end)which can be rearranged to the even simpler (though perhaps less intuitive):
where a.end >= b.startEven if we have to allow for null end dates this is now very simple:
and a.start <= b.end
where nvl(a.end,b.start) >= b.startI don't claim that any of the above is original, I am sure this algorithm appears in many SQL and other books. But I see variants of the long-winded version (sometimes bug-ridden ones) so often I thought it worth documenting here so I can point to it in future.
and a.start <= nvl(b.end,a.start)

How many times do you see this error page while building an Apex page?
ERR-1777: Page 1 provided no page to branch to.To avoid that, I have a habit of creating an unconditional branch back to the same page in every page I build, with a sequence number higher than all the conditional branches. If I then add new conditional branches I have to ensure that I change the default sequence to a lower value.
Please report this error to your application administrator.
"I don't understand why we have to create these unconditional branches at all - why can't the default behaviour be to branch back to the same page if no other branch is taken? When is the "no page to branch to" error ever useful?!"In Apex 4.0, this annoyance finally disappears:
"When no branches have been defined then branch page back to itself rather than showing an error."
Sometimes the little things make all the difference!







select job from emp where empno = :p2_mgr
select dname
from dept join emp using (deptno)
where empno = :p2_mgr
SQL> select text from user_source as of timestamp (sysdate-1/24)
2 where name = 'MY_PACKAGE'
3 order by line;
no rows selected
select obj# from sys.obj$ where name like 'PKG_MY_OVERWRITTEN_PKG%'
/*
Then, using the obj# run the following (as of 3 hours ago):
*/
select source from sys.source$ as of timestamp(sysdate-((1/24)*3)) where obj# = 1234567
order by line
/*
You can't look at sys.obj# as of any time previously.
These tables form the basis of the ALL_SOURCE database view.
*/select * from sys.source$
as of timestamp (sysdate-1/24)
where upper(source) like '%MY_PACKAGE%';