How to create download procedure?
I upload the zip file into the blob column, but I want to provide the url for the users to download the zipfile. I don't want to use intermedia and web agent. What should I do?
Here's a code snippet that uses OO40 and VBScript to fetch a Blob and push it out the Response object. It uses the connection pooling capabilities of OO40, so I have included the connection pool creation call which should placed in your global.asa file under the Applicaiton_OnStart() routine.
==========================================
<!-- global.asa file -->
<!-- declare the OO4O automation object -->
<OBJECT RUNAT=Server
SCOPE=APPLICATION
ID=OraSession
PROGID="OracleInProcServer.XOraSession">
</OBJECT>
' and type library
'compsrv FILE="c:\orant\bin\oip8.tlb"
<!--METADATA TYPE="TypeLib"
FILE="d:\oracle\ora815\bin\oip8.tlb"
-->
<!-- put this in Application_OnStart() -->
'create a connection pool
OraSession.CreateDatabasePool nInitPoolSize, _
nMaxPoolSize, _
nSessionTimeout, _
szImpbService, _
szImpbUserPass, _
0
=========================================
<!-- ASP application -->
<%@ LANGUAGE=VBScript%>
<%
'Sub routine to fetch a blob from the database
Sub ReadBlob(blob, size)
Dim vBuffer
'Set parameters for multi-piece read
nLobChunk = CInt(Application("LOB_CHUNK")) * 1024
blob.offset = 1
blob.PollingAmount = CLng(size)
'Read the first hunk and write to output
vBuffer = null
nBytesRead = blob.Read(vBuffer, nLobChunk)
Response.BinaryWrite(vBuffer)
'Read and write the rest
While blob.Status = ORALOB_NEED_DATA
vBuffer = null
nBytesRead = blob.Read(vBuffer, nLobChunk)
Response.BinaryWrite(vBuffer)
Wend
End Sub
'Oracle related variables
Dim ImDb
Dim setItems
'Get the input parameters
szDomain = Request.QueryString("domain")
szMediaId = Request.QueryString("id")
'build the SQL string
If szDomain = "i" Then
szSQL = "select i.image_clip.getContent() blob, " & _
"i.image_clip.getMimetype() mime, " & _
"i.image_clip.getContentLength() clipSize " & _
"from image_items i where i.image_id = " & szMediaId
ElseIf szDomain = "a" Then
szSQL = "select i.audio_clip.getContent() blob, " & _
"i.audio_clip.getMimetype() mime, " & _
"i.audio_clip.getContentLength() clipSize " & _
"from audio_items i where i.audio_id = " & szMediaId
ElseIf szDomain = "v" Then
szSQL = "select i.video_clip.getContent() blob, " & _
"i.video_clip.getMimetype() mime, " & _
"i.video_clip.getContentLength() clipSize " & _
"from video_items i where i.video_id = " & szMediaId
Else
Response.Write("Bad domain variable: " + szDomain)
Response.End
End If
'Get a database connection
Set ImDb = OraSession.GetDatabaseFromPool(2000)
'fetch the blob handle
nOptions = ORADYN_NOCACHE + ORADYN_READONLY
Set setItems = ImDb.CreateDynaset(szSQL, nOptions)
Response.ContentType = setItems("mime").Value
'read the whole blob
Call ReadBlob(setItems("blob").Value, setItems("clipSize").Value )
%>
null
Similar Messages
-
How to create a procedure in oracle to write the data into file
Hi All,
I am just wondered on how to create a procedure which will do following tasks:
1. Concat the field names
2. Union all the particular fields
3. Convert the date field into IST
4. Prepare the statement
5. write the data into a file
Basically what I am trying to achieve is to convert one mysql proc to oracle. MySQL Proc is as follows:
DELIMITER $$
USE `jioworld`$$
DROP PROCEDURE IF EXISTS `usersReport`$$
CREATE DEFINER=`root`@`%` PROCEDURE `usersReport`(IN pathFile VARCHAR(255),IN startDate TIMESTAMP,IN endDate TIMESTAMP )
BEGIN
SET @a= CONCAT("(SELECT 'User ID','Account ID','Gender','Birthdate','Account Registered On') UNION ALL (SELECT IFNULL(a.riluid,''),IFNULL(a.rilaccountid,''),IFNULL(a.gender,''),IFNULL(a.birthdate,''),IFNULL(CONVERT_TZ(a.creationDate,'+0:00','+5:30'),'') INTO OUTFILE '",pathFile,"' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '' LINES TERMINATED BY '\n' FROM account_ a where a.creationDate>='",startDate,"' and a.creationdate <='",endDate,"')");
PREPARE stmt FROM @a;
EXECUTE stmt;
DEALLOCATE PREPARE stmt ;
END$$
DELIMITER ;
Regards,
Vishal G1. Concat the field names
Double Pipe (||) is the concatenation operator in Oracle. There is also a function CONCAT for this purpose
2. Union all the particular fields
Not sure what do you mean by UNION ALL particular fields? UNION ALL is a set operation applied on two different result sets that have the same projection.
3. Convert the date field into IST
SQL> select systimestamp "Default Time"
2 , systimestamp at time zone 'Asia/Calcutta' "IST Time"
3 from dual;
Default Time IST Time
05-05-15 03:14:52.346099 AM -04:00 05-05-15 12:44:52.346099 PM ASIA/CALCUTTA
4. Prepare the statement
What do you mean by prepare the statement?
5. write the data into a file
You can use the API UTL_FILE to write to a file. -
How to create a procedure to send a mail if the Database is down?
Hi,
I have created the below procedure to send a mail if the count is less than 1300. It scheduled daily @ 15 30 hrs. Its fine.
CREATE OR REPLACE procedure SCOTT.hrsmail
is
v_count number;
begin
Select count(*) into v_count from emp;
if v_count < 1300
then
UTL_MAIL.send(sender => '[email protected]',
recipients => '[email protected]',
cc => '[email protected]',
bcc => '[email protected]',
subject => 'Testing the UTL_MAIL Package',
message => 'If you get this, UTL_MAIL package
else
null; --what you want to do here
end if ;
end;
Sometime the Database is down, so the job is not running.
How to create a procedure to send a mail if the database is down?
Pls help me. Its highly appreciated.
Thanks
Niharnihar wrote:
How to create a procedure to send a mail if the database is down?And what if the database is up, but the network down? Or the database up and mail server down? Or mail server undergoing maintenance?
There are loads of "+What if's+" - and in that respect, playing "+What if database is down..+" in this case does not make any sense. You do not use the database to monitor its own up/down status. You do not rely just on SMTP as notification protocol that the database is down.
The correct approach would be using something like SNMP as the monitoring protocol. A monitoring system that can process SNMP and perform some basic root cause analysis (e.g. network to the database server down, database server status unknown). And this system supporting notification methods like SMTP, SMS and so on. -
How to create a procedure function with a return value of ref cursor?
Can anybody provide a sample about how to create a procedure function with a return value of REF CURSOR?
I heard if I can create a function to return a ref cursor, I can use VB to read its recordset.
Thanks a lot.http://osi.oracle.com/~tkyte/ResultSets/index.html
-
How to create stored procedures and use those in Crystal reports
Hi All,
Can anyone explain me how to create a stored procedure and use that stored procedure in Crystal reports. As I have few doubts in this process, It would be great if you can explain me with a small stored proc example.
Thanks in advance.Hello,
There is a document explainining how to use Oracle stored proc with Crystal reports.
Check at:
https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/1084c536-711e-2b10-e48a-924a60745253
It is for older version but it should work and you can refer to it to get general idea how to start with it. It has a sample oracle stored proc and how to connect it from Crystal Reports. -
HOW TO CREATE STORED PROCEDURE IN DATA INTEGRATOR
Hi to every one,
Can any one help in giving me a solution for creating stored procedure in Data Integrator.
I m new to this fieldHi nath,
Firstly are you using MYSQL or Oracle as the database,if its oracle database then follow this
http://obiee101.blogspot.com/2008/01/obiee-using-oracle-stored-procedure-to.html
http://oraclebizint.wordpress.com/2008/02/20/oracle-bi-ee-101332-executing-stored-proceduresfunctions-before-reports-before-report-triggers-and-global-temporary-tables/
EXEC [DATABASE_NAME].[SCHEMA_NAME].[PROCEDURE_NAME][DATABASE_NAME] --> is the database name your creating your procedure
[SCHEMA_NAME]-->is the user with which your creating
[PROCEDURE_NAME] --> the name given to procedure
You dont know how to get those run this SQL in TOAD and see select sys_context('userenv','db_name'), sys_context('userenv','session_user') from dual
(OR) open you connection pool properties window in RPD,you will get the DB name and the user name as the schema name
hope answered your question.
CHeers,
KK -
How to create a procedure to change randomly passwords
Hello,
I am trying to create a procedure to change randomly passwords for all users in a database. I need this after the database cloning. I have too many users to alter in a manual way...
Is there any option to create a procedure which will fetch all users in a database and alter them by a random password?
I was not able to find any clue.
Could you help me?
ThanksWelcome to the forum.
change randomly passwords for all users in a database.All users? Including SYS/SYSTEM? I hope not...
But you could use DBMS_RANDOM.STRING and ALL_USERS and dynamic SQL.
http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_random.htm#sthref4675
http://download.oracle.com/docs/cd/B19306_01/server.102/b14237/statviews_2114.htm#REFRN20302
http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261/dynamic.htm#LNPLS01101
(easy to find when you do a quick search from http://www.oracle.com/pls/db102/homepage or http://www.oracle.com/pls/db112/homepage)
DBMS_RANDOM.STRING can give you a random password easily:
select dbms_random.string('x', 10)
from dual
connect by level <= 10;Zo you could do something like:
begin
for rec in ( select t.username
, dbms_random.string('x', 10) new_pass
from all_users t
-- where t.username not in (...)
-- or
-- where t.username in (...)
loop
--execute immediate ' alter user '||rec.username||' identified by '||rec.new_pass;
dbms_output.put_line ('New password for user '||rec.username||' = '||rec.new_pass);
end loop;
end;
/You'll have to fill in the where-clause yourself/
I also commented out the dynamic alter user statement, since I'm not sure if you really want to reset the pwd's for all users.
Also, instead of using dbms_output.put_line to check the new passwords, you could insert them in a table or spool the output to a file. -
How to create stored procedure directely in RPD
Hi Gurus,
I am trying to create stored procedure directly in physical table in rpd level in OBIEE.for this one i have gone through below website.
http://obiee101.blogspot.com/2011/01/obiee-using-mssql-stored-procedure-as.html
in that blog they mentioned to write some query which is...........
EXEC [DATABASE_NAME].[SCHEMA_NAME].[PROCEDURE_NAME]
in above query i am not getting what is DATABASE_NAME,SCHEMA_NAME,PROCEDURE_NAME
can any one elobrate this oneHi nath,
Firstly are you using MYSQL or Oracle as the database,if its oracle database then follow this
http://obiee101.blogspot.com/2008/01/obiee-using-oracle-stored-procedure-to.html
http://oraclebizint.wordpress.com/2008/02/20/oracle-bi-ee-101332-executing-stored-proceduresfunctions-before-reports-before-report-triggers-and-global-temporary-tables/
EXEC [DATABASE_NAME].[SCHEMA_NAME].[PROCEDURE_NAME][DATABASE_NAME] --> is the database name your creating your procedure
[SCHEMA_NAME]-->is the user with which your creating
[PROCEDURE_NAME] --> the name given to procedure
You dont know how to get those run this SQL in TOAD and see select sys_context('userenv','db_name'), sys_context('userenv','session_user') from dual
(OR) open you connection pool properties window in RPD,you will get the DB name and the user name as the schema name
hope answered your question.
CHeers,
KK -
How to create several procedures from several script files?
Hello,
I have several procedures for SAP HANA. Every procedure is stored in a script file. I can only use SAP HANA Studio. How can I easily run all script files to create all procedures on a schema? Can somebody help me?
Best regards,
Y.HuHi Fernando,
Thank you very much for you explanation.
My scripts contain native sql statements for creation stored procedures “CREATE PROCEDURE … AS BEGIN … END”. They are not objects for or from Content/package. The procedures should be created direct in a project schema.
The option with hdbsql command line is not possible because I may not use hdbsql (unfortunately not allowed for me).
The option all scripts into a big file is a possible option for me. The big file has only 1600 lines. But there is a strange problem with the text “FOR” in script (please see the thread http://scn.sap.com/thread/3728741 ). Unfortunately SAP HANA Studio cannot run my big script.
I hope there is a solution or workaround for this problem.
Best regards,
Y.Hu -
How to create approval procedure when saved as draft?
How can I create an approval procedure where the document is saved as draft?
Specifically, returns saved as draft where document total is greater than $3,000 need approval.
ThanksHi,
Approval Procedures cant be used in draft mode. Approval Procedure itself acts as document in draft. It wont do inventory postings & financial postings as well. Just create approval procedure with your requirement & try.
I am looking forward your reply,
Regards,
Maheswaran. -
How to create stored procedures automatically when creating new company
I need to create a method in our add-on Business One application that will create stored procedures at the time we install the add-on (when the new company is created). Where would I store the SQL scripts, and what SAP Business One commands do I need to use to build the stored procedures into the new company database? Can someone give me an example of how to do this? We are coding in C#, but an example in visual basic would also be helpful if no one out there in forum land uses C#
Thanks,
Nancy Walk
[email protected]Hi Nancy!
Of course are there people here that use C#
To solve your problem, create a routine in your add-on that checks at startup if the stored procedures are present. If they are not, create them. You can use the DI-API, or just add them directly to your database.
<i>Note: SAP does not like it when you play around directly in the SAP databases, and does not supply support for databases that are changed manually. You'd better use the DI-API...</i>
Hope it helps...
Grtz, Rowdy -
XML Forms: how to create download link
Hi,
can anybody tell me, how i can create a download link to a document rid
in an XML form?
I can create a link which will open the referenced document, but "right klick
link | save target as..." will produce an error, since the link is a javascript call.
Thanks for any help,
bye,
Markus SteinbergHi Markus Steinberg,
i need to create the Download attachement Option In XML Form..
U got the solution for that above thread..
If so please tell me how to create? and then how to create multiple Link ?
Regards
Thillai J -
How to create a procedure using program unit
Hai All
Ii have created a procedure like this
PROCEDURE Duty_calc
IS
procedure w_Time
is
begin
update dail_att set wtime= (select lpad((to_number(to_char(outtime,'hh24mi')-to_char(intime,'hh24mi'))),4,0) from dail_att where attend_date=f_date);
end w_time;
begin
if wtime >0830 then
update dail_att set etime= (select lpad(wtime-0830) from dail_att where attend_date=f_date);
else
null;
end if;
duty_calc;
end duty_calc;
And i have declare in the program unit as Duty_calc and while i am executing my procedure i had an error
is it must i need to declare a my inner procedure in my program unit
Regards
Srikkanth.Mthe same question you asked 2 month ago and same mistake you are doing
- Procedure name can only be one.
- Count proper BEGIN ENDs
PROCEDURE Duty_calc
IS
BEGIN
begin
update dail_att set wtime= (select lpad((to_number(to_char(outtime,'hh24mi')-to_char(intime,'hh24mi'))),4,0) from dail_att where attend_date=f_date);
end;
begin
if wtime >0830 then
update dail_att set etime= (select lpad(wtime-0830) from dail_att where attend_date=f_date);
else
null;
end if;
end;
END; -
How to create stored procedure that can be read through Hyperion intelligen
hello everyone out there. I need some help I create a select stored procedure and would like to run it through Hyperion intelligence with some input parameters. The procedure is not working. it is throwing an error when I execute it through Hyperion. Also how do I put multiple values like an array sort of things in a where clause like this where name in('test', 'test1). I place the stored procedure below any help will be greatly appreciated.
CREATE OR REPLACE PROCEDURE emp_by_dept (
p_deptno ert_dept_t.dept%TYPE
IS
emp_refcur SYS_REFCURSOR;
v_dept ert_dept_t.dept%TYPE;
v_deptname ert_dept_t.deptname%TYPE;
BEGIN
OPEN emp_refcur FOR SELECT dept, deptname FROM ert.ert_dept_t WHERE dept = p_deptno;
DBMS_OUTPUT.PUT_LINE('dept deptname');
DBMS_OUTPUT.PUT_LINE('----- -------');
LOOP
FETCH emp_refcur INTO v_dept, v_deptname;
EXIT WHEN emp_refcur%NOTFOUND;
END LOOP;
CLOSE emp_refcur;
END;Chrome has its own PDF viewer plugin that is quite buggy when it comes to PDF forms (as do Firefox and Safari, by the way).
So yes, the best solution is to download the file and then open it locally using Adobe Reader. However, you can't enforce that. It's up to the user and their browser settings. You can only recommend it to them. -
How to create downloadable vcs file for a single event (not whole calendar)
Is it possible to create a vcs file in ical that, like the reservation made on opentable, can be downloaded and opened in both ical and outlook? I've tried creating an event listing for website visitors to add to their calendar, but some of the outlook users have trouble with the ics file opening as a meeting, not an event, or opening as a complete calendar. Big problem. Any solution?
How are you making the .ics file? What value has the METHOD: entry?
AK
Maybe you are looking for
-
On my website I created a map page with hotspot links. The hotspots work fine in Safari and Netscape but not at all in Internet Explorer. What did I do wrong? Here's the URL http://www.kayakamelia.com/maps.html Jo-D
-
Word macro ConvertToPDF absent in Adobe 9? (redirected from windows forum)
Dear all, In VBA I make use of the macro Application.Run MacroName:="ConvertToPDF" This worked fine in previous versions of Acrobat. Since an upgrade to Adobe 9 The code fails on this line. I have temporarily solved this by implementing the pr
-
My Macbook sometimes doesn't connect to my Wireless N network
I had my topcase replaced by apple a few weeks ago. Since then I've noticed my macbook SOMETIMES doesn't connect to my wireless N network (from my AEBS running on 5.8ghz frequency). It's strange because most of the time it finds the network fine. But
-
LDAP integragtion for DMM using Digital Signage
We are in the process of investigating Active Directory via LDAP. I have seen documentation for the Video Portal but not much on the Digital Signage. First does anyone have any experience with this and its limitations or gotcha's? The real question
-
when you've bought the keynote app on the mac app store does it allow you to download it on an ipad for free.