PL/SQL Count pages from pdf blob - sql

I have a situation in which I have a blob file whose type is .PDF and I need to count the pages in the PDF. Is there a way to do it without any external (3rd party) libraries? I know that there is PL/PDF tool but I need to do it only in PL/SQL. I am using Oracle 11g version, and the files is sitting in the table.
Any help will be appreciated, thanks.

I think you can go with Java in the Oracle database.
Check how to do it with Java only here or there.
Next steps would be to :
load the required JAR libraries in the Oracle database
create a Java Source in the database with the java code in it
create a PL/SQL function that will wrap the Java class (once the source is compiled).
Use this PL/SQL function to get the number of pages in your PDF through Java.
Those are the main lines but I think it's the best way if you want to stay with open source and free software.

Related

How to Upload .xls Files into Oracle DB using PL/SQL only

I'm fairly new to using DBs and have been tasked to create an automated process that uploads Excel-Files into a Oracle Database.
I was told that the User should put the files into a dedicated folder and then a process should automatically upload the files. After checking Stackoverflow and the Internet, however it looks to me like there is no way to do the upload with just PL/SQL.
Do i need to use other external tools to achive this or am i just looking the wrong way?
The reason i want to do it with just PL/SQL is that i don't have sys rights on the server or a way to install any tools right now.
You can upload CSV files stored in a folder using SQL Loader directly into Oracle Tables. But you need to have those files stored as CSV not XLS and transfer them to a folder in a server which contains at least an Oracle client. In this case, your user should save the files as csv, and then you must have a pick up process to move them to a server where you can run the sql loader process.
However, if you want to keep using Excel, and you have no option to move the files, Oracle Application Express which is free and included with Oracle Database contains a plugin to upload directly and automatically excel files into tables. You would have to create a small application in Apex with a page for doing this. It is totally out-of-the-box and quite easy. If you use Apex 18c or higher, it is there. If you use Apex 5.1.4 you need to install a plugin. In this case, the user is responsible to upload the excel file by the web apex application, or you can use the API APEX_DATA_PARSER package for doing so without manual intervention. However, keep in mind that if you use the API, you need to have the files accessible for the database.
Apex Data Parser 19c
Let me know if you have more doubts about it.
Regards

release postgresql extension

I'm developing application that holds data in postgres. So i must prepare database before working with application, there must be created few tables. I'm creating this tables by running sql code but i think it's not convenient after i found this doc:
A useful extension to PostgreSQL typically includes multiple SQL
objects; for example, a new data type will require new functions, new
operators, and probably new index operator classes. It is helpful to
collect all these objects into a single package to simplify database
management
The main advantage of using an extension, rather than just running the
SQL script to load a bunch of "loose" objects into your database, is
that PostgreSQL will then understand that the objects of the extension
go together
I believe that i must use this approach
What i don't understand is that how can i share my extension. I thought that it works like maven, you create your extension with custom types, functions, tables and than you can pack it, name it (eg my-ext-0.1), give a version and release into some kind of a repository. After that you can connect to a database, run sql 'create extension my-ext-0.1' and have everything done :)
I thought that 'create extension' command will download extension and install it without downloading this by hands. I use maven, ivy and i expected similar behaviour from postgresql.
Documentation says that you need to place your extension files under some directory and only than run 'create extension' under some database.
How do you create your extensions and share them between different servers?
Postgres extensions do not work like this. They can have access to database internals and can run any code as database OS user. Therefore installing them is typically limited only to superusers, from a specific directory and only some of them are available on managed hosting servers.
I though that you can achieve something similar with installing your supplemental functions, types and tables in a special schema which is added to a search path. Upgrade would then be as simple as:
drop schema mylib cascade; -- don't do this!!!
create schema mylib;
\i mylib.sql
But unfortunately this would also remove all dependent objects from other schemas - columns using a custom type, triggers using a custom function etc. So it's not a solution for your problem.
I'd rather create my functions, types and all in my schema, using available extensions and "standard" languages.
Postgres will not download your extension (unless you create extension that will add this functionality to postgres). But your extension should be still created "usual" way.
to check your "directory for extension", run:
t=# create extension "where should I put control file";
ERROR: could not open extension control file "/usr/local/share/postgresql/extension/where should I put control file.control": No such file or directory
And repeating comment, before extending SQL, please check out plpgsql and existing commands.
When you get bored and make sure existing postgres functionality is too limited, install postgres-contrib package and check other extensions as best practices. And of course check out https://pgxn.org/

How to create pdf Template with the dynamic values

I am stuck in this task from a month ago so my last option is to post my query on stack-overflow.
I have to find a PDF Creation tool where i can crate my PDF Template and also i can assign a data source like sql server or any thing else. by which the sql server dynamic data can replace the value of pdf template Tags.'
I have tried many tools like Foxit and bulzip . But any of the tool does not meets my requirement. I must say I have completely stuck in this Task.
So Please give me appropriate solution . Immediate response will be appreciated.
If you want to create pdf in client side, you can try jspdf
If you are using php for server side, you can try mpdf.
Have a look at wkhtmltopdf. It's a very simple console utility that creates PDF from HTML. So basically you need to generate HTML markup. You can use some scripting language (PHP, python, etc.) or templating engine, depending on what exactly you want and what tools you are familiar with.
Create HTML/CSS markup for your template.
Define places where you want to put dynamic data, mark it
somehow.
Create script that will query database for your data and then
Either use search&replace in your script to place real data, or
copy whole HTML as a template using some templating engine (for
instance, PHP is itself a template engine, so you can basically
place save template as PHP file where real data is placed where
needed).

Free Software to Allow Users to Run Oracle SQL Scripts but NOT create them

We would like to allow users to run custom Oracle 11G SQL scripts that have been created for them, complete with parameter prompts, and get a CSV extract of the resulting dataset. Right now, I just use SQLPlus and SQLDeveloper to do those things, but those tools would allow the creation of custom scripts as well, and we do not want users to try to create custom queries.
In many cases we intend to fulfill this need with Crystal Reports/Crystal Server, but we use CR XI, and sometimes very WIDE extracts are difficult to create because of the page size limitations. It also has a limit for the number of concurrent users, and sometimes we may need more.
Does anyone know of a FREE tool that can allow users to execute Oracle SQL Scripts and get file exports as a result and yet will NOT allow them to create new Scripts?
NOTE: We have a Citrix environment and therefore are able to limit where the script files are located and what access users have to those files and folders.
Given that a SQL script is just a text file, I'm not sure I see how this could be possible but perhaps I'm missing something about how you see something like SQL*Plus allowing the creation of custom scripts. If you give me any tool that runs SQL scripts, I can always open my favorite text editor, write a SQL script, and have your tool run it (assuming that you allow users to create new files in your Citrix environment or to map a file from their local machines).
Personally, I'd probably create a small APEX application in the database that would present a menu that let users pick an export. Behind the scenes, the APEX app would run whatever select was necessary (I'd generally create a CLOB in the database rather than a file on the file system assuming unless you're making a great deal of use of SQL*Plus formatting commands in your scripts) and would allow the user to download the file (or use some alternate file delivery mechanism such as email).
I use jasper reports for that: http://jasperforge.org/index.php?q=project/jasperreports

List reports with inline SQL in SQL Server Reporting Services?

I have a couple of inline SQL in many of our reports on the report manager.
Now I need to do some code change for all of them, is there a way to list all those reports based on the inline SQL and not any SP?
Thanks,
D
You can use the reporting services API to get the report from the web service and do a search for the appropriate tags in the XML. The MSDN documentation for the report definition XML schema and diagrams can be found here and a diagram of the data source related parts here. The API documentation can be found here.
You can write .Net programs that upload and download reports from the Reporting Services API, using ReportingService.GetReportDefinition and SetReportDefinition. You can upload or download the report definition into a buffer, which can be read or written to disk. Somewhere I have an Ironpython prototype that does this, which I'll post if I find it.
To use this, you need to query the WSDL and generate a stub. The tool to do this is called WSDL.EXE. If I can find it I'll post it here, but you could just as easily use C#.
There is also a tool called rs.exe that comes with BIDS which takes a VB.net program and tops and tails it with includes for the Reporting Services API. You can use this to execute a VB.Net script from the command line - essentially it tops and tails the program, compiles it behind the scenes and runs it against a report server.
You can either do what NXC suggested or if this is a one time activity, you can simply open the RDL file for the report in a text editor and search for common SQL strings like "select", "delete" etc in order to find the reports which have inline SQL