SQL & PL/SQL :: Converting Utl_http Read_text To PDF File
Oct 25, 2012
I was tinkering around with utl_http api in pl/sql. Essentially I wanted to connect to our report server and retrieve an oracle report from the database(not forms). I got the report successful but by using the utl_http.read_text the pdf is essentially a clob now and how to convert the clob to pdf and save it on my local pc. I've looped through the clob converting it to raw and tried the utl_file.put_raw and put_line but it didn't work.
I am trying to send SMS through a web service, and before doing it on a form, I tried to check this with UTL_HTTP from sql plus
below given is the code i tried
SQL> SET DEFINE OFF SQL> SELECT UTL_HTTP.REQUEST('http://80.227.146.106/Receiver/sms99.aspx?usr=JOE123&pass=JOE321& msisdn=971556221690&msg=test msg through ibuzz&mt=0') FROM DUAL;
Your request used a protocol that is not currently supported.
</TD></TR> UTL_HTTP.REQUEST('HTTP://80.227.146.106/RECEIVER/SMS99.ASPX?USR=JOE123&PASS=JOE321&MSISDN=97155 <TR><TD> </TD></TR> <TR><TD> </TD></TR> </TABLE> </BODY></HTML> **********-----------------------------------------------------------------------------------------------------------------------------------------------------------******** protocol used for the web service is HTTP. they have given an IP with port number . and the method is GET
[URL]........
parameters are msisdn, msg, mt their response would be either true or false. I tried this on Oracle9i Enterprise Edition Release 9.2.0.1.0 and the message is Your request used a protocol that is not currently supported. when i tried the same on Oracle Database 11g Release 11.2.0.1.0 i got
I'm calling a web service with HTTPS protocol from a pl/sql program and i'm using the UTL_HTTP package for do this.
I have a Oracle DB installation 11g Enterprise Edition Release 11.2.0.1.0 on my personal computer with a Windows XP OS, and when i run the code it works fine and returns the result I expect. But, when i run the same code on the Oracle DB of my work (Oracle 10g Enterprise Edition Release 10.2.0.4.0 and OS HP-UX) it fails and give me an error, i think that the error has to do with the configuration of the wallet and the certificates in it, because i consume the WS from Os prompt using the command WGET and works fine and i test consuming a WS with HTTP no secure and works fine too.
This is the code and the result in the Oracle DB 11g on my computer:
Connected to Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 Connected as oe@oRCL
There are at most 2 entries of a in b. Depending on the value of the type column in B, this determines whether the entry should be male or female. I want to have a select statement that will retrieve 2 rows into one row essentially like below, how is this done:
id male_name female_name 1 paul paula
the column names will appear as such, if its a 0 its a male name if its 1 its a female name, there will generally be 2 entries in B for 1 value of a.
SELECT CASE WHEN "PIVOT_ROW_GENERATOR"."ID" = 0 THEN "PIVOT_SOURCE"."ID_NUMBER" WHEN "PIVOT_ROW_GENERATOR"."ID" = 1 THEN "PIVOT_SOURCE"."ID_NUMBER" [code].........
There are millions of DISTINCT ID values in TABLE_1 and corresponding to each ID there are some values for all the days of a month. I need to insert these values in TABLE_2 in the above format.
select * from function('input') where the function dynamically returns different tables.
I have gotten to the point where I can return the cursor but I cannot format it as a table to use in the query. It return's it as XML. This is my function:
create or replace FUNCTION CAMS_FUN_GEN_REPORTS(PARAM1 IN VARCHAR2) RETURN SYS_refCURSOR AS BEGIN DECLARE p_recordset SYS_refCURSOR; begin OPEN p_recordset FOR 'SELECT * from STATS_FLAGGED_TOTALS_ME'; RETURN p_recordset; END; END CAMS_FUN_GEN_REPORTS;
This is my query:
select * from CAMS_FUN_GEN_REPORTS('')
So normally you would do this
select * from TABLE(CAMS_FUN_GEN_REPORTS('') as tabletype)
But I will never know the end result table as it will be dynamic so I have to find a way to cast the result of the function into a new table I can select on.
I have looked into pipe lining also but from what I can tell you still need to know the table definition. Which I can't know from the client side. The server will control the 'routing' and thus the end result of the select.
We are able to insert CLOB into database, Using oracle Text I'm able to search inside clob. [two questions solved ]. The question arise when we need to send this data to application either as file or as text(varchar2).
I'm able to generate file from CLOB using function,unfortunately it resides inside db and developer is not able to access it.
1)There is option to mount application partition inside db and export file over there but it is not viable option according to management.
2)I've Googled the solution to create JAVA API. Which will perform OS command like scp to send file from db to app(or any remote host). For security reason this option is also dropped.
3)I tried dbms_lob.substr but actual text inside clob is too long. File generated from CLOB sized around 5 MB.
So I guess it requires lot of effort if I wanted to convert into varchar2 as out parameter inside function.
So, to give CLOB data to developer as file or as varchar2. I'm not able to get any solution. Is there any other option using database to convert to string/varchar2 from CLOB ? Or do I need to drill down more into third option.
I am converting from 10g to 11g app server and having problem with the exec_sql.execute command. In my 10g version, the code is:
Declare lv_dbms_journal_cursor exec_sql.curstype; lv_status INTEGER; BEGIN IF (exec_sql.IS_OPEN (lv_dbms_journal_cursor)) THEN exec_sql.close_cursor(lv_dbms_journal_cursor); [code].....
After this code caused the 11g forms session to crash, I modified the 11g version to the below, and it still crashes.
Is the 12c version of the Grid Control only for Oracle Cloud? Not completely sure of exactly what cloud computing is. Looks like a conglomeration of shared resources. Anyway we are converting all of our servers over to vmware virtual machines except the ones we manage in other states. I am upgrading each database to 11 r2 as we convert the servers. Anyway my Grid server is next to convert to a virtual machine. I am using Grid Control 10.2.0.5.0 now. I want to upgrade to the latest version of the Grid control. 12c seems to stress and boast about managing the "Oracle Cloud" to manage regular single node Oracle servers as well as vmware virtual machines?
I have seen lots of examples of using PIVOT to return an sql query where the rows have been converted to columns. All the examples I can find require you to have two columns with multiple rows, and also require you to know the data which is in one of columns to make titles for the new columns.
I need something a little different...I have a query using UNION which goes something along the lines of...
SELECT [get data from one place] UNION SELECT [get data from another place] UNION SELECT [get data from another place]
this returns the following... a_val ----- 100 200 300
query to return something like this... a_val1 a_val2 a_val3 ------ ------ ------ 100 200 300
The names of the columns don't really matter. And I dont want to create a new table in the database just for the result.
We have a queue in which the message is coming from external system. The payload of the queue table is a PL/SQL record type. Once we get the message in the queue, we de-queue the message and read through the PL/SQL type collection and process the message.
From the below query, we are able to convert the PL/SQL collection message to XML message and see the data.
SELECT dbms_xmlgen.getxml ('SELECT USER_DATA FROM <Queue_table> X WHERE X.USER_DATA.SALE_ORDER.P_HEADER_REC.ORIG_SYS_DOCUMENT_REF=800501298') FROM dual;
The new requirement is the message would come in a XML message in the queue. So my question is, is there any way through which the XML message can be converted to the PL/SQL record structure directly (it would be the opposite operation of the above query).
oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production PL/SQL Release 11.1.0.6.0 - Production "CORE 11.1.0.6.0 Production"
I have a .xls file, which has few columns with Korean data. I have problem converting it into .csv. I converted it to UNICODE TEXT, which was TAB separated. I replaced tabs with commas. but still saved it as .txt file. Now I am using utl_file package to open and read.
I Have a table like this. 12 rows and 8 columns.And column 1 Dt is going to change everytime,as date and months proceeds.and corresponding columns values are going to change.
I need to prepare a bilingual system (English and Arabic).
So i need to store data in English as well as in Arabic
Is there any possibility to convert the data from English to Arabic and Arabic to English through oracle forms
basically what i am thinking is let us suppose user selected the English version of the application and he entered all the data in English during saving the records i need to convert all the English data into Arabic and store it in another table for Arabic data reference.
select to_clob(1) from dual union select wm_concat(sysdate) from dual;
wm_concat returns a clob. To make both queries in the union have the same type columns i convert the column in the first query to a clob but Oracle gives me an [1]: ORA-00932: inconsistent datatypes: expected - got CLOB error even though both are returning a clob value.
Each of the queries work individually and both return a clob value.
Is it possible to communicate with a serial device (via COM1) with oracle forms / webutil? I am able to communicate in java using RXTXcomm, but I am having problems making a bean that uses it (getting security errors and yes, I have signed the jars).
Basically, I have a scale hooked up to my COM1 port and want to be able to send commands (zero and tare) to it and read the weight from it through a form or java bean.
need to create a table with single column by using select statement with multiple columns For Ex- i have 1 row with 10 columns (may be more than 10) like 'A','B','C','D','E','F','G','H',I','J' i written sql like select 'A','B','C','D','E','F','G','H','I','J' from dual
result is - 'A','B','C','D','E','F','G','H','I','J' with 10 columns
Now i need output lik this using SQL Text ------ 'A' 'B' 'C' 'D'
I have written a trigger & procedure to call a webservice from pl/sql procedure. Everything was working fine until I was told to use nchar & nvarchar2 instead of varchar2 as per requirement. Now I am not able to run the procedure and getting errorcode with return response from server.
I didn't changed the width of columns but only datatype. What precautions do I need to take in code while doing this and what could have caused the error only by converting the data type.
I have a table A, whose table structure is in the below format.
Table A
ID DESC VALUE 123 A 454 123 B 1111 123 C 111 123 D 222 124 A 123 124 B 1 124 C 111 124 D 44
Now i need to insert the data from this table to another table B, the sturcture of which is as below
Table B
ID A B C D 1234541111111222 124123111144
How do i frame a query to fetch data from table A and insert that into table B? I don't want to use max and decode combination. as it would return only single row for an ID. I need all the id's to be displayed.
I am working on a script that is reading from a numeric column converting it to a character string where the decimal is dropped (assumed) and the value is padded with leading zeros to fill the specified lengh. Using to_char(payment_amt,'FM0000000V00') is working fine for non-negative values. When the value of the field is a negative number the output includes a leading - (i.e., -000002458).
For the negative numbers I need to convert them to a 'Signed EBCDIC' value, where the last digit is converted to a specified character (in the above example it would be changing the 8 to a Q) and also replace the - with a zero, resulting in 00000245Q.
What I am doing is generating a fixed-length record with values in a specific location. What I'm getting now looks like this:
My company use a sybase database that runs business jobs. Currently we run SQL queries from Perl to gather time information on the jobs. Now we have an application that is using Oracle. The server it is on, doesn't have perl, so I am using a shell script to login to sqlplus and run a query for a job and it's end time. I have accomplished this. However, here is the 2 problems I am having.
1. The query reults are returned in Scientific time, I'm able to convert that to EPOCH time in the SQL syntax, however, it comes back with a 13 digit time, instead of 10. The last 3 digits are zero. How can you remove the last 3 digits in the query or convert the 13 digits to Human Time. Right now when you see the select statement, I am doing a to_char to get it to EPOCH time.
2. How to only show the latest time in the query and not show ALL job end times from it's past runs.
Here is my shell script, and I do realize this maybe a select statement syntax solution to one or both, but the UNIX time stamp is puzzling.
#!/usr/bin/sh sqlplus -S username/password@JAWSPROD <<eof> myfile set heading off feedback off verify off select JAWS_APP.JAWSJOB.JOBNAME, to_char(JAWS_APP.JOBRUN.ENDTIME) from JAWS_APP.JAWSJOB, JAWS_APP.JOBRUN where JAWS_APP.JAWSJOB.JOBID = JAWS_APP.JOBRUN.JOBID and JAWS_APP.JAWSJOB.JOBNAME in ('pa_box_settle'); exit
I wanna convert the amount of money from number to string such as 144.5 to be one hundred forty four point five is there any function or i have to write my function? How could i put new line in the string?
for example if i have 'SAB Bank' || 'Riyadh'
but i want SAB bank to be displayed in line and Riyadh in line.