I have an interactive report, where the query is combined, so I can't use editable interactive grid. That's why I have to use manual form in my query.
I've found some nice tips about the APEX_ITEMs, but I have problem with my process.
In my query there are columns like:
APEX_ITEM.HIDDEN(1,coursestudent.id)
...
APEX_ITEM.SELECT_LIST(2,coursestudent.signed,'Signed;1,Failed;0')
I have a submit button, and here is my process:
FOR i in 1..apex_application.g_f01.count LOOP
UPDATE coursestudent
SET signed=apex_application.g_f02(i)
WHERE id=apex_application.g_f01(i);
END LOOP;
I've thought that it's not too difficult, but after I press Submit nothing happens, except that the Success message is written out the page.
What should I do?
I'm using the Oracle Apex version: 5.1.1.00.08
Thanks to Jeffrey, I found the error: it is a bug.
I had to copy-paste the sql query again, and it works now. Ok, really, in that case I always put a select 1 from dual in it's place, save, and just after that paste back the query.
I've faced this bug before that, sometimes the new columns just don't showing in the page. Since I put the hidden column after I first create the query, it hadn't shown in the page, so the loop in the process never worked.
Related
I have been using Lazarus 2.x (free pascal) with firebird 3 (via flamerobin) and i try to commit records via TSQLConnection, TSQLQuery, TDBConnection in data module (appeals) etc.
I run the following code snippet and the records are successfully commited to firebird, but unfortunately DB connection afterwards is lost and thus there is not any record to be seen via DBGrid (not even column headers - totally blank). I have to terminate the application and reopen it to gain visual insight of my firebird via DBGrid.
Button click event
appeals.SQLTransaction1.Active:=false;
appeals.SQLQuery1.SQL.Text:='UPDATE appeals set name=:name,date_entry=:entry,date_suspended=:suspended,'+
'date_court=:court,date_judgement=:judgement where id='+IntToStr(row_num);
appeals.SQLQuery1.Params.ParamByName('name').AsString:=Trim(Edit1.Text);
appeals.SQLQuery1.Params.ParamByName('entry').AsDate:=DateTimePicker1.Date;
appeals.SQLQuery1.Params.ParamByName('suspended').AsDate:=IncDay(DateTimePicker1.Date,10);
appeals.SQLQuery1.Params.ParamByName('court').AsDate:=DateTimePicker2.Date;
appeals.SQLQuery1.Params.ParamByName('judgement').AsDate:=IncDay(DateTimePicker2.Date,20);
appeals.SQLTransaction1.StartTransaction;
appeals.SQLQuery1.ExecSQL;
appeals.SQLTransaction1.Commit;
I have also used .CommitRetaining as exactly mentioned in lazarus forum without success. Any idea what could i do in order to see my records live in DBGrid after commit.
Regards
The reason the DBgrid shows nothing is that SqlQuery1.ExecSQL does not return a result set, so SqlQuery1 cannot supply any records for the DBGrid to display. So call SqlQuery1.Open after your Commit.
However, before you can call SqlQuery1.Open, you need to give it a SELECT statement to Execute, because a SQL UPDATE statement does not return a result set, as you have already found. So, do something like:
[...]
appeals.SQLTransaction1.StartTransaction;
appeals.SQLQuery1.ExecSQL;
appeals.SQLTransaction1.Commit;
appeals.SQLQuery1.Sql.Text := 'Select * from appeals where ...';
appeals.SQLQuery1.Open;
obviously replacing '...' in the 'where' clause by something appropriate. Normally. a SELECT query should be parameterised to limit the number of rows returned and the amount of time the table is locked on the server.
I have a long-running page in Oracle Apex, this is an interactive report page, which fetches the report based on the Username, From_Date and To_Date parameters users provide.
The query used for this report page is executing without any issues(0.07 Sec) in SQL developer. When I checked the Debug log to debug the long run, I found the statement "... do not save: same value / password / no session" in the log which is the reason for the long run. The page never loads and end up in a gateway time out. The expected number of rows for the given parameters in mere 161 rows. Please find the screenshot of the debug log below. Please help me with this.
At the beginning I found a different issue in the Debug Log, which was due to 'IR binding: "APXWS_MAX_ROW_CNT" value="1000000"'. Later I removed the Maxrowcount value and made it null. So this was taken care.
A few ideas; see whether any of those helps.
How do you run the report? Did you set "Page action on selection" for those parameters to "Submit"?
If not, how about creating a SUBMIT button which would submit the page (and, thus, put items' values into session state)?
If you use a source for those items, try to set them to be used "always, replacing any existing value in session state".
I have a requirement where 300 columns had to be processed. I am trying to achieve this using IG automatic row processing (DML). When writing the code in the editor I get a error stating 'Value too long by 2015 characters'.
I suppose this is an Oracle Apex limitation. Can someone please share their views on this?
When writing the code in the editor ...
I'd say that your problem isn't related to number of columns, but a large query which can't fit into "SQL Query" item of the Page Designer.
Which Apex version do you use? I can't tell for sure (as I don't know it), but my impression is that Apex up to version 4.2 had that item limited to VARCHAR2(4000) so - if your query is larger than that, it won't fit (such as in your case - query you wrote is 2015 characters longer than the maximum size the item allows). In 5.x version, you can put a whole lot of query into the item (as if it was modified to a CLOB).
Now, as you use Interactive Grid and it appeared in 5.x version, huh ... maybe what I wrote above isn't entirely true. Unfortunately, you can't switch to a query whose source is a function that returns query (such as in Classic Reports), as you could write a (stored) function and simply call it from Apex.
As you said that you used automatic row processing, did you put too much code somewhere in there?
On the other hand, I Googled a little bit, looking for limit of column numbers in the IG - couldn't find anything official, but someone complained (here, on StackOveflow) that they tried to create an IG with over 100 columns, and it didn't work.
So, yes - maybe you hit the limit, but I can't confirm it. Hopefully, someone who knows Apex better will be able to assist. Alternatively, consider asking the same question on OTN forums, as people who designed Apex answer questions there.
When I issue a query like select * from city; using oracle sql developer in mac I get the output that is not aligned and it is very hard to read. How do I get the grid view and set it as default?
Sounds like you're getting the script output. You can have that formatted nicely by using SET SQLFORMAT ansiconsole, we'll make the columns line up as nice as possible based on the size of the display.
But if you want the data back in a grid, use Ctrl+Enter or F9 or the first execute button in the toolbar to execute.
This will get you the output in a grid, like this:
I talk about both executing as a script or statement here.
If your issue is with formatting, you may want to look at this link
If your issue is with records not getting inserted, please note these.
Records inserted in one session will not be visible in another session unless they are committed.
If you are checking the count in the same session where you inserted the records, then check for errors in insert. Add a show errors command at the end of your script, "path_to_file.sql" to check if any errors occurred while inserting the records.
Hope this helps.
I have an APEX 5.0.3.00.03 page with dozens of criteria fields, followed by a region containing an Interactive Report (IR). I want to defer the IR being produced until a "Generate" button is clicked, but I am having troubles. The report without criteria would generate millions of rows, via a nasty 5 table join, so I want to defer it processing until the user is ready. I know that I can do a /*+ FIRST_ROWS */ hint, but still want to avoid invoking the SQL until the user picks some criteria.
I tried the following:
Created a Hidden Field P210_WAIT, initial value of 'TRUE', which I included in the SQL criteria like this:
select * from tab_1, tab_2, tab_3, tab_4, tab_5
where :P210_WAIT != 'TRUE'
and -- join, and dozens of other criteria here
and in a dynamic action on the Generate button, I do two things:
Execupte PL/SQL Code to set :P210_WAIT := 'FALSE';
Refresh Action:
Action: Refresh
Affected elements: Selection Type: Region. Region: (region containing my IR)
I have debug statements in the PL/SQL code, and they are appearing, but the SQL to produce the report is not being run, implying that the Refresh Action is not "waking up" the IR.
It does appear the IR SQL is being executed on page load, as I was dynamically setting the IR Attribute "When No Data Found" value to initially say "Please select criteria and click the Generate button to display report" and that was working.
If I understand your problem correctly, your main problem here would be: the dyanamic action to refresh the region is not working, am i correct?
If that is the problem, try this:
First, make sure that all the bind variables in the source query is listed on the Page Items to Submit under the source query region.
Then, Assign Static ID for the IR region.
Next will be, changing the Refresh dynamic action to Execute Javascript and paste this
$('#static_id').trigger('apexrefresh');
Hope this helps.