oracle apex select list - oracle

I'm using Oracle Apex 4.2. I have a select list. I'm trying to create a dynamic action that should be simple enough but I'm not sure how to do it. I'm also trying to insert selected value in database using plsql code but there some error occur.
lets say
How would I make this dynamic action?

Create item PX_SELECTLIST
Create dynamic action
Event = Change
Selection Type = Item(s)
Item(s) = PX_SELECTLIST
Create true action "Execute PL/SQL Code"
PL/SQL Code = Your PL/SQL code with begin end block - reference item value by :PX_SELECTLIST within the code.
Page Items to Submit = PX_SELECTLIST
Page Items to Return = leave it blank
Test it - each time value in PX_SELECTLIST changes the dynamic action is fired and PL/SQL code is executed.
Additionaly I suggest reading Oracle APEX docs - http://www.oracle.com/webfolder/technetwork/tutorials/obe/cloud/schema/42/dynactions/dynactions.html

Related

I don't know why the pl/sql does not use the value of the item

My Apex application has one main page where the user can see all entries, if he want to change he clicks on the left button and go to the detail side.
The main page
If the user load the detail page a dynamic action Starts and the PL/SQL Function body do his job.
declare
v_DB_ZAUE number;
begin
SELECT COUNT(*) INTO v_DB_ZAUE FROM DB_ZAUE WHERE CCB_ID = :P21_CCB_ID;
return v_DB_ZAUE;
end;
Now starts my problem, on the detail page is the value of the item P21_CCB_ID Displayed put the PL/SQL Code ignores it. Because if the PL/SQL Code works the field with the name Temp were 1 and not 0.
Here is the detail page
PS: I check the names of all variables there are all OK.
I presume you didn't put P21_CCB_ID into Dynamic Action's Items to Submit property, so I'd suggest you to do so.
Because, without it, P21_CCB_ID item's value isn't in session state so it (query) behaves as if it doesn't exist (or uses value that was previously put into session state, and that's not what you really want).

Oracle apex apex_application.g_f0x don't get table items

I have a report with apex_item(s). The report is complicated so I show only what is relevant for simplification.
The report is created with:
select ID || apex_item.hidden(11,ID) as "ID",
apex_item.text(p_idx => 12, p_value => VOLUME) as "Volume"
from TEMP;
That gives:
On submit page, I have a process that counts the report rows (later I loop on this rows to do some action):
apex_debug.warn('count f11: ' || apex_application.g_f11.count);
The result is 2 as expected.
The problem - when I try to save changes from the report without submitting the page:
I have a button "update server" which have a dynamic action on click with PL/SQL action:
The PL/SQL contains exactly the same code as the loop above but the result is now 0.
My goal is to make actions based on the rows. without submitting the page, But I can't understand how can I loop this rows without submit.
Thanks
When you're running a Dynamic Action of the type Execute PL/SQL Code (now called "Execute Server-side Code"), you can specify page items to be submitted with the action that will be set in session state before the PL/SQL block runs, but I don't think you can specify those fxx whatever they're called type of items. I think you have two options:
Create a hidden item and populate that with a Javascript action that runs before your PL/SQL action, then submit that hidden item along with your PL/SQL action.
Change your PL/SQL code to an Ajax Callback process, then invoke it with apex.server.process in a Javascript DA. You can specify fxx type items to submit with that call.

How to pass item value to oracle function in oracle application express?

I have item in oracle apex
P12_MOBILE_NUMBER
on form load I am fetching data using fetch row from and set to different items. Once mobile number set to item P12_MOBILE_NUMBER, I want to pass its item value to oracle function and function returned value set to P12_MOBILE_NUMBER again .
I can call my function like
Select stars(mobile_number)as mobile_number from dual;
Please help me out how can I do that , I am using application express 18.2
Create a Page Load dynamic action:
set its True action to "Execute PL/SQL Code"
that code would be
:P12_MOBILE_NUMBER := stars(:P12_MOBILE_NUMBER);
Items to submit: P12_MOBILE_NUMBER
Items to return: P12_MOBILE_NUMBER
Run the page; automatic row fetch will fetch row value, and page load dynamic action will modify the mobile number (based on what your function actually does).

Making a search bar manually WITHOUT interactive report. (Oracle APEX)

I am trying to make an application completely manually without using any interactive reports or generated PL/SQL. Everything is working at the moment but I am stumped when it comes to the search bar and I can't find anything online to help me.
I have a classic report called 'Browse Job Vacancies' and a 'Search' button; I also have the 'C1_JOB_TITLE_ITEM' search bar and a page process called 'Search'.
In the process I have this code:
SELECT
JOB_CODE,
JOB_TITLE,
JOB_DESCRIPTION,
SITE_NAME,
EMAIL_ADDRESS,
TELEPHONE_NUMBER,
SALARY,
START_OF_PLACEMENT,
APPLICATION_METHOD,
APPLICATION_CLOSING_DATE
FROM JOB
WHERE upper(job_title) = upper(:C1_JOB_TITLE_ITEM);
I am getting this error:
ORA-06550: line 1, column 64: PLS-00428: an INTO clause is expected in this SELECT statement
So I created this code:
DECLARE temp_row char;
BEGIN
SELECT
JOB_CODE,
JOB_TITLE,
JOB_DESCRIPTION,
SITE_NAME,
EMAIL_ADDRESS,
TELEPHONE_NUMBER,
SALARY,
START_OF_PLACEMENT,
APPLICATION_METHOD,
APPLICATION_CLOSING_DATE
INTO temp_row
FROM JOB
WHERE job_title = :C1_JOB_TITLE_ITEM;
END;
Here I am getting this error:
ORA-06550: line 13, column 16: PL/SQL: ORA-00947: not enough values
I am completely stumped on what to do at this point so any help at all is greatly appreciated. Sorry if I'm not being detailed enough this is my first time writing in Stack Overflow.
(Editing because someone didn't think this was an answer.)
You say you have a page process. You don't need any sort of process for this. You should have a Region with the following properties (assuming 18.x):
Type = Classic Report
Source > Location = Local Database
Source > Type = SQL Query
Source > SQL Query > your query from your first block above
Apex will run the query and create a report based on it. Processes are for PL/SQL blocks that do something like populating data or manipulating the database in some way.
When you enter a keyword in your item and click your button (the button action should be Submit Page), Apex will populate C1_JOB_TITLE_ITEM in session state with the user's value, then use that in the bind variable when it re-generates the page.
1) Create a classic report with that SQL as the source code.
2) Set C1_JOB_TITLE_ITEM in Page Items To Submit attribute, just under region source.
3) Create the page item C1_JOB_TITLE_ITEM, as your search field.
4) Create a Dynamic Action on Change of that item, and refresh your classic report region. The timing of this refresh is up to you. Step 2 ensures the value you've typed in the browser is sent to the database for the purpose of re-running that query.
Do you have a function based index on upper(job_title)? Otherwise you may experience performance issues.

How to pass new PK to stored proc in Oracle Apex

I have your standard Oracle apex page to create / edit / delete a record.
I now wanted to call a stored proc when a new record is created (only on INSERT, not update/delete), so I created a Process on the page and tied it to the create button.
All is well so far....it calls the stored procedure as expected as verified by the debug messages I put in there. However, I wanted to pass the new PK created as part of the new record to the stored proc. However it is receiving null.
The process I created is set to run "On Submit - after Computations and Validations" which I think is right.
Can someone suggest why I might not be getting the new key? Is it still not available yet at that point in the form processing?
Any help appreciated.
If you are using a standard Apex "form on a table", then you can set the Return Key into Item property of the Process Row of ... process to specify a page item that will get populated with the PK of the inserted row:
You can then reference the item in your procedure call.

Resources