Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

ORA-01795, limit on in clause

405508Mar 15 2004 — edited Mar 13 2012
hi guys,

I have the following query,

Select
shogen_no,
shogen_desc,
disp_turn
From
shogen
where
shogen_no in ('one', 'two', 'three', ..........'more than thousand')

When I try to run it, the ORACLE (8.1.6) gives me following error:
ORA-01795 maximum number of expressions in a list is 1000

Can anyone explain the situation?
1) Cant we put more than 1000 values in 'in clause'.
2) What is the other way of doing it.

I am running this query in a PL/SQL procedure. First of all I gather the values and put them in a varchar2 (shogenList). Then I put that variable in the 'in clause' i.e. where shogen_no in ('||shogenList||')..

Thanx for any help
Omer

Comments

InoL

Without displaying the HTML content on the report.
If it is a hidden column, the output is not available for your JavaScript function.

Depending on your database version, you can run the same JavaScript in the database:
https://blogs.oracle.com/java/post/multilingual-engine-executing-javascript-in-oracle%C2%A0database
Maybe you can use html2pdf directly in the database to convert the output of your FUNCTION_RETURNING_HTML.

Another option is open source pdf packages, e.g.:
GitHub - lee-lindley/PdfGen: A PL/SQL PDF report generator providing some of the column, column break and header capabilities of sqlplus reports. Built on as_pdf3 from Anton Scheffer (included). (0 Bytes)Instead of FUNCTION_RETURNING_HTML, create a function FUNCTION_RETURNING_PDF.

Adnan3114

@inol Thanks for the suggestions.
Our live software is running on 11g database and APEX 5.1, but we are migrating it to 19.0c database with APEX 22.1. So we can't actually run the Javascript code from database.
We already have set up the reports as function that returns HTML so it would be really time consuming (which we can't afford at this moment) to convert those to be able to use PL/SQL PDF gen feature.
I am trying to download the hidden div but I am unable to make it work. I even tried to push the div out of displayable regions using CSS but that too was no use.

Adnan3114
Answer

I have managed to find a solution.
Turns out changing Region header type to hidden and setting the WHOLE REPORT on the region header seems to work and downloads the report in PDF.
Here are the steps:
In the APEX page I have created a region (name: reg_1) which has these attributes: Header - Hidden, Style - Remove UI Decoration, Remove Body Padding. This region will only serve for us to download the PDF and nothing else.
Now in the reg_1 region's header, I have added this HTML: <div id="content"></div>
Created a page item :PX_PK_ID.
Then, created a Dynamic action change event for :PX_PK_ID that has 2 true actions. This dynamic action's scope should be set to Dynamic.
Action 1- SQL Statement Set Value: select FNC_RETURN_HTML(:PX_PK_ID) from dual; and for jQuery Selector #content (ID of the header HTML in step-2).
Action 2- Execute Javascript Function that is down_pdf() which will download the elements in #content div using html2pdf.js library after Action 1 is complete.
Finally, create the classic report region: SELECT PRIMARY_KEY, col1, col2, "DOWNLOAD" as DOWNLOAD from TABLE and for the DOWNLOAD column, change its type to link and set the link to URL like this: javascript:$s("PX_PK_ID",#PRIMARY_KEY#);
Voila! It works like a charm!

Marked as Answer by Adnan3114 · Aug 3 2022
1 - 3
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Mar 14 2023
Added on Mar 15 2004
12 comments
240,903 views