Is it possible to write plsql procedures for htmldb operations
We have several htmldb applications configured on our system.I would like to know if I could perform following operations on htmldb :-
1) Is there a way to disable/lock some htmldb user.If so, what is the API that needs to be used so, that a procedure can be created and executed at sql prompt rather than using web interface?
2) API to change password of a user.
3) API to attach a schema to a workspace.
4) Is there any concept like readonly users in htmldb who can only view the code but not perform any edit operations?
Thanks,
Lavanya
hi lavanya--
i'm assuming your user questions are in reference to users within the htmldb development environment. if that's the case, please find my answers below:
1) Is there a way to disable/lock some htmldb user.If so, what is the API that needs to be used so, that a procedure can be created and executed at sql prompt rather than using web interface?
you can update an htmldb user's "Developer Privileges" by using the wwv_flow_fnd_user_api. it's technically not a supported api, but it's been pretty solid for years. the spec for the api's pretty well documented and you can get to that .sql file in your local install at $ORA_HTMLDB_HOME/marvel/core/wwv_flow_fnd_user_api.sql specifically, the p_developer_roles parameter of the edit_fnd_user is the key to this answer.
2) API to change password of a user.
also available via wwv_flow_fnd_user_api
3) API to attach a schema to a workspace.
no. i've just logged an enhancement request for this, though.
4) Is there any concept like readonly users in htmldb who can only view the code but not perform any edit operations?
no, but this idea is already under consideration.
regards,
raj
Similar Messages
-
Need to write a procedure for Log files (scheduled jobs)
Hi,
We have around 50 scheduled jobs.Jobs will run parallelly. In these jobs, some jobs will repeat at different timings.in these some jobs are daily jobs and some are weekly and some are monthly and some will run first and second working day of the month and some will run on some particular days.
Now I want to write a procedure like, For every job it should create a log file like "
<Job_Name> started on <Date> at <start_Time(timestamp)> and completed on <Date> at <End_Time(Timestamp)> successfully.
<Job_Name> started on <Date> at <start_Time(timestamp)> and completed on <Date> at <End_Time(Timestamp)> abnormally.
If all jobs complted successfully it should send an email to the mailgroup with attached log file (which contains the details of all the jobs) with format as follows.
Jobname Start_date Start_time End_Date End_Time Status
SALES 21-May-2011 12:00:00 21-May-2011 12:01:00 Completed Successfully
21-May-2011 12:15:00 21-May-2011 12:16:00 Completed successfully
Proudcts 21-May-2011 23:00:00 21-May-2011 23:16:00 Completed successfully
ITEMS 21-May-2011 23:00:00 21-May-2011 23:16:00 Completed successfully
If the status ="Completed abnormally" for any particular job
immediately it should send an mail to the group like " FATAL_MESG_JOBANAME_Date_Time(timestamp)"
for example if SALES job was failed at 15:00:00 then immediately it should send a mail.
if ITEMS got failed then it should mail ( in between any job got failed it should send an email).
if every thing is going cool then need send a final success mail to the group.
so Please let me know how to write a program for this requiremnt.
Thanks in advance.832581 wrote:
Hi,
Thanks for giving valuable link to gain the knowledge on DBMS_SCHEDULER.
But here I didn't get clear idea to write a program which I need to schedule the job for every 1hr.
Please suggest me to write the program..
ThanksYou'll have to read the link i sent. Or google for an example. -
How to write a procedure for update the table
Hi all
can any body please tell me how to write a procedure to update the table......
I have a table with about 10,000 records...........Now I have add a new column and I want to add values for that like
registration Code Creidits
13213 BBA
1232 MCS
I had add the creidit now i want to update the table.........the new value want to get by SQL like
Creidit = select creidit from othere_table...........
Hope u can understand my problem
Thanks in advance
Regards
Shayan
[email protected]Please try the following --
update Program_reg a
set TotalCreidit = ( select tot_cr <Accroding to your logic>
from Program_reg b
where a.Registration = b.Registration
and a.Enrollment = b.Enrollment
and a.code = b.code
where a.Registration in ( select distinct Registration
from Program_reg );
N.B.: Not Tested....
Regards.
Satyaki De. -
Hi Everyone,
There are two schemas A and B, I want to create a procedure for table creation in schema B using table of schema A and some filter(where clause). In procedure i will pass two argument-
1- Table name(in schema A) by using which we will create a new table in schema B including with some suffix as SYSDATE.
2- Filter( Where clause)
How can i write this procedure ? can anyone suggest me?
Thanks,
AbhijeetAman.... wrote:
arpit sinha wrote:
First of all I have just shown him the way how to create a table in side procedure and he can use CTAS to create table by selecting other schema user's table.
Thats it
and without having create any table privileged how you can create table in other schema user.Hmm well, if one is sitting in his schema and creating tables in another schema, that design itself needs tuning. The priv create any table, IMHO is not required , at least in most of the cases.
What is wrong with you i dont know plz dont run behind me...Huh?
Run after you? I really don't think that its true and I don't have any intention whatsoever to do it either. Its just a tech discussion and I raised a doubt where I thought I had one, thanks to my very less knowledge about Oracle db. Probably the thought came to you because of other threads where I had mentioned that the reply was wrong like here,
pfile
And I guess here as well, where I just mentioned that reading one book alone doesn't make any one good in the art of performance tuning(PT).
Re: tuning
Anyways, I shall not "run behind" you anymore, apologies if I sounded rude.
A R P I T S I N H ACheers
Aman....Hi Aman
Plz dont take it otherwise I apologizes for every thing that I have written over there
I am not even saying against your knowledge of Oracle plz dont feel bad about me...
I m less experienced and need to learn how to behave and also about Oracle from you..
forget that stupid reply by me I AM SORRY
A R P I T S I N H A -
How to explicitely write PLSQL code for "Help - Display Error"? [SOLVED]
I'm using menu DEFAULT&SMARTBAR and I'd like to write command in PLSQL code for "Help - Display Error" to display error. Has anyone any idea how to do this? I can not find syntaks in form help for this.
Message was edited by:
marussigDisplay_Error;
-
Need Assistance to write a procedure for the below requirements!!!
Hi Forum,
Could some body give me a hand in writing an oracle procedure to pull the results as per the below requirement
A JOBNUM is transfered from the first JSP page to second JSP page and based on that JOBNUM I have to write a procedure to populate the second page
I need to pull these feilds from the respective tables
QM_JOB_NUM, QM_JOB_STATUS from QMI which matches the value of the JOBNUM from the first JSPpage
QN_JOB_GPH_FILE, QN_COMMENTS from QNI where QM_JOB_NUM = QN_JOB_NUM
VM_NAME concertnate with VM_SURNAME from VMI where QM_PROFILE = VM_PROFILE
QF_NARRATIVE_1,QF_NARRATIVE_2,QF_NARRATIVE_3( if these feilds has any values in DB then only pull them, if not dont pull them.so, we need to put a IF condition) where QF_JOB_NUM = QM_JOb_NUM
JI_DESC from JII where QM_USER_STATUS = JII_STATUS _CODE
RR_NAME from RRI where QM_REP = RR_REP
and
a case condition to match the QM_JOB_STATUS to the string value ( LIVE, PENDING , CLOSED ) as the QM_JOB_STATUS stores in the database as the numerical values 1,2,3 and while displaying on to the web page I need to match to the correspond string value and display it
if ( QM_JOB_STATUS ) = 1 then print to the webform LIVE
if ( QM_JOB_STATUS ) = 2 then print to the webform PENDING
if ( QM_JOB_STATUS ) = 3 then print to the webform CLOSED
Thanks for your assistance.
Cheers,
Krishna.First off, you need to turn the requirement into a sql statement. If I followed things correctly, that would be something like:
SELECT qmi.qm_job_num,
DECODE(qmi.qm_job_status, 1, 'LIVE',
2, 'PENDING',
3, 'CLOSED') qm_job_status,
qni.qn_job_gph_file,
qni.qn_comments, vmi.vm_name||' '||vmi.vm_surname name,
qfi.qf_narrative_1, qfi.qf_narrative_2, qfi.qf_narrative_3,
jii.ji_desc, rri.rr_name
FROM qmi
JOIN qni ON qmi.qm_job_num = qni.qn_job_num
JOIN vmi ON qmi.qm_profile = vmi.vm_profile
LEFT JOIN qfi ON qmi.qm_job_num = qfi.qf_job_num
JOIN jii ON qmi.qm_user_status = jii.jii_status_code
JOIN rri ON qmi.qm_rep = rri.rr_rep
WHERE qmi.qm_job_num = p_jobnumP_jobnum in the query is the parameter you will pass to your stored proc.
Next, you need to decide how many rows will be returned for a particular job number. If there will be more than one row, then you will probably need to return a ref cursor. If there will be only one row, then you could return either a set of variables, one for each column in the resultset, or a record type with a field for each column.
If you are returning a ref cursor or a record type, then you probably want to build the stored proc as a function, if you are returning multiple variables, then you will need to build it as a procedure.
So, to return a ref cursor, the signature of the function would look something like:
CREATE FUNCTION get_page2 (p_jobnum IN qmi.qm_job_num%TYPE)
RETURN sys_refcursor ASReturning a record type would be similar except that you would RETURN the record type you defined in the database.
To return several variables in a procedure, the signature would look something like:
CREATE PROCEDURE get_page2 (p_jobnum IN qmi.qm_job_num%TYPE,
p_status OUT VARCHAR2,
p_gph_file OUT VARCHAR2,
p_comment OUT VARCHAR2,
p_name OUT VARCHAR2,
p_narrative1 OUT VARCHAR2,
p_narrative2 OUT VARCHAR2,
p_narrative3 OUT VARCHAR2,
p_desc OUT VARCHAR2,
p_rrname OUT VARCHAR2) ASHTH
John -
Is it possible to write a script for Excel Chart Conversion to an ai file?
I tried to record a script and it didn’t work. I will attempt to explain what I am doing (and why) and maybe you guys can tell me if it can be done or not. We are working with Excel charts and we eventually put them into InDesign for a print magazine. Here are the steps as best as I can translate. We are using Illustrator CS6 Version 16.2.0.
1. Copy Chart from Excel
2. Paste into Illustrator
3. Fit Art Board to Graphic
4. Select All
5. Change Kerning to 0
6. Select the Background
7. Select Same Fill Color
8. Change Color to 5% Black
9. Select the grid lines on the Chart
10. Change the Stroke to 50% Black
11. Save as an AI file
There is also a scenario where there are multiple charts and we would like to make multiple art boards in the same file.
I do this for a few reasons: Remove Rich Black, Adjust Kerning, Eliminate any Font Issues, Easier to Scale, and it chokes our rip because there is no link when they are copied and pasted directly from Excel to InDesign.
Any guidance would be appreciated.no can do, there's no access to mesh point with scripting, sorry about that.
have you tried Mesh Tormentor? it is free!!!, but I don't know if it will help with your problem
http://www.meshtormentor.com/ -
Is it possible to use mod-osso for htmldb applications
We previously used sso_sdk for registering htmldb(1.4) applications as partner applications to avail single sign-on facility provided in oracle application server.
Can we use mod_osso for registering html db 1.5 applications as partner applications? If so, could you please provide me the links to the documentation on how to achieve this.
Regards,
LavanyaLavanya,
No, mod_osso is not quite ready for PL/SQL applications that share a DAD the way HTML DB does. We're working on getting mod_osso enhanced to allow that integration. In the meantime, you can continue to use the SSO SDK and the pre-configured authentication schemes in HTML DB. They will work fine.
Scott -
The simplest way for plsql procedure to return multiple rows
Hi,
What is the simplest way for plsql procedure to return multiple rows (records). There are many combination of ways to do it but I am looking for a solution that is appropriate for plsql beginners. Many solutions use cursors, cursor variables, collections and more that kind of things that are complex on the face of it. Is it somehow possible to achieve the same with less effort?
Sample query would be: SELECT * FROM EMPLOYEES;
I want to use returned rows in APEX to compose APEX SQL(in that context plsql) report.
It is enough to use just SELECT * FROM EMPLOYEES query in APEX but I want to use plsql procedure for that.
Thank you!Hi,
It depends :-).
With +...that is appropriate for plsql beginners...+ in mind... it still depends!
The list of techniques (ref cursors, cursor variables, collections, arrays, using explict SQL) you have referenced in your post can be made to work. but...
+Is it somehow possible to achieve the same with less effort?+ Less effort : That needs to be defined (measured). Especially in the context of pl/sql beginners (who is a beginner?) .
What is the level of "programming experience" ?
What is the level of understanding of "Relational Result set" as processible in Oracle?
If you are looking for
Process_the_set_of rows_in APEX () kind of capabilitywhich "abstracts/hides" relation database from developers when working on relation database, it may not be the best approach (at least strategically). Because I believe it already is abstracted enough.
I find REF CUROSOR most effective for such use, when the "begginer" has basic understanding of processing SQL result set .
So in a nut shell, the techniques (that you already are familiar with) are the tools available. I am not aware of any alternative tools (in pure Oracle) that will simplify / hide basics from develpers.
vr,
Sudhakar B. -
How to use dynamically column_name and column_name value in plsql procedure
hi,
how to use dynamically column_name and column_name value in plsql procedure.
for example, i have one table with column col1.i want write plsql code with dynamically execute the insert one schema to another schema.
by
sivaDECLARE
CURSOR C
IS
SELECT cc_cd
FROM TEMP1 WHERE s_flg ='A' AND b_num IN('826114');--,'709537','715484');
CURSOR D
IS
SELECT * FROM cONSTRAINTS_test ORDER BY SRL_NUM;
STMT VARCHAR2(4000);
p_target_schema VARCHAR2(30):='schema1';
p_source_schema VARCHAR2(30):='schema2';
BEGIN
FOR REC IN C
LOOP
FOR REC1 IN D
LOOP
STMT := 'INSERT INTO '||p_target_schema||''||'.'||''||REC1.CHILD_TABLE||' SELECT * FROM '||p_source_schema||''||'.'||''||REC1.CHILD_TABLE||' where '||REC1.COLUMN_NAME||'='||REC.cntrct_cd||'';
Dbms_Output.Put_Line('THE VALUE STMT:'||STMT);
END LOOP;
END LOOP;
END;
cc_cd='434se22442ss3433';
cc_t_ms is parent table-----------------------pk_cc_cd is primary key
cc_cd is column name
CONSTRAINTS_test table
CHILD_TABLE NOT NULL VARCHAR2(30)
CONSTRAINT_NAME NOT NULL VARCHAR2(30)
COLUMN_NAME NOT NULL VARCHAR2(400)
R_CONSTRAINT_NAME VARCHAR2(30)
CONSTRAINT_TYPE VARCHAR2(1)
PARENT_TABLE NOT NULL VARCHAR2(30)
SRL_NUM NUMBER(4)
CHILD_TABLE CONSTRAINT_NAME COLUMN_NAME R_CONSTRAINT_NAME CONSTRAINT_TYPE PARENT_TABLE SRL_NUM
a aaa cc_CD pk_cc_CD R cc_t_MS 1
bb bbb Cc_CD PK_CC_CD R cc_t_MS 2
bb_v bb_vsr S_NUM PK_S_NUM R bb_v 3
cC_HS_MS cc_hs_CD cc_CD PK_CC_CD R cc_t_MS 4
cC_HS_LNK cc_HIS_LNK_CD H_CD PK_HS_HCD R cC_hs_ms 5
cC_D_EMP cc_d_EMP Cc_CD PK_CC_CD R cc_t_MS 6
i want insert schema1 to schema2 with run time of column_name and column value.the column_name and values should dynamically generated
with refential integrity.is it possible?
can any please quick solution.its urgent
by
siva -
Procedure for Archive the data
Hello Experts,
I need to write a procedure for clean up the data base. Below is my rek.
User should be provided with options of entering the table name and also should be given option to select whether he wants to delete all the data or archive the table.
--> Program should provide the list of tables that are related to the table name that was given by the user. (This is not required if the table is stagging table, as they don't have constraints associated with them)
--> If user wants to archive then the data in the tables and its related table should be archived (exported) into a flat file and then delete the data from each table in a sequence. Else, we need to delete the data without archiving.
Can you Please let me know the procedure for the above rek and also I am not sure about the archiving the data. If you don't know the table name and the columns. so How can you define a cursor record to handle the record.
Can you please send me the complete code for the above rek to [email protected]
I appreciate help in this regard.
Thanks & Regards,
Sree.Can you please send me the complete code for the
above rek to [email protected]
I appreciate help in this regard.The goal of this forum is not to make your job, but to assist you with guidelines, references, and concepts, on specific issues. If you want someone to code for you, then you should hire a programmer instead.
~ Madrid -
How Can i get PLSQL Procedure out values in Shell Script?
Hi,
I need to use PLSQL Procedure out values in shell script by using that parameter i need to check and call the other procedure. Please can you guide me how can i?
#!/bin/ksh
# Function to call validation program
SQL_PKG_CALL()
echo "Inside SQL_PKG_CALL for $file"
sqlplus -s /nolog << EOF
whenever sqlerror exit failure
connect ${APPS_LOGIN}
variable exit_value NUMBER
set serveroutput on size 100000
DECLARE
l_errbuf VARCHAR2(10000) := NULL; l_retcode NUMBER := NULL;lv_test VARCHAR2(4000) := NULL;
BEGIN
fnd_global.apps_initialize ( USER_ID => ${USER_ID}, RESP_ID => ${RESP_ID}, RESP_APPL_ID => ${RESP_APPL_ID}
, SECURITY_GROUP_ID => ${SECURITY_GROUP_ID}
#Calling PLSQL procedure for create and attache document
XXAFPEEP_SO_DOC_ATTACH_INT.DOCUMENT_ATTACH (p_errbuf => l_errbuf, p_retcode => :RETMSG, p_fileName => $file
, p_debug => 'Y', p_rettest => lv_test);
# to print the procedure return values
DBMS_OUT.PUT_LINE('Return Message: '|| lv_test);
#${RETCODE}=l_retcode;
print :RETMSG;
END;
EXIT 0
EOF
# Program starts here
echo "+---------------------------------------------------------------------------+"
echo "Program Start"
APPS_LOGIN=${1} # Apps Login
USER_ID=${2} # User ID
RESP_ID=${5} # Responsiblity ID
RESP_APPL_ID=${6} # Responsiblity Application ID
SECURITY_GROUP_ID=${7} # Security Group ID
DIRECTORY_PATH=${8} # Directory --Attached file locations
DIRECTORY_NAME=${9} # Directory Name for plsql
echo "User ID : $USER_ID"
echo "Responsibility ID : $RESP_ID"
echo "Responsibilith Application ID : $RESP_APPL_ID"
echo "Security Goup ID : $SECURITY_GROUP_ID"
echo "Directory Path : $DIRECTORY_PATH"
echo "Direcotry Name : $DIRECTORY_NAME"
echo
#files direcotry
cd $DIRECTORY_PATH
echo Present Working Directory: `pwd`
echo
#for all file names
ALL_FILES=`ls *.pdf`
for file in $ALL_FILES
do
if [ -f $file ]
then
#log "Processing $file" # future
echo Processing: $file
# Calling the PL/SQL Program
SQL_PKG_CALL;
#echo "Retcode : $RETCODE"
echo "RetMessage : $RETMSG"
else
log "Skipped $file: invalid file"
echo "Skipping current file $file: not a valid file."
fi
done
Thanks
SudheerSaubhik's provided the solution, but just for fun:
Test procedure:
create or replace procedure get_ename
( p_empno in emp.empno%type
, p_ename_out out emp.ename%type )
is
begin
select ename into p_ename_out
from emp
where empno = p_empno;
end get_ename;Test data:
SQL> select empno, ename from emp order by 1;
EMPNO ENAME
7369 SMITH
7499 ALLEN
7521 WARD
7566 JONES
7654 MARTIN
7698 BLAKE
7782 CLARK
7788 SCOTT
7839 KING
7844 TURNER
7876 ADAMS
7900 JAMES
7902 FORD
7934 MILLER
14 rows selectedTest call from SQL*Plus to show it working:
SQL> declare
2 v_ename emp.ename%type;
3 begin
4 get_ename(7844,v_ename);
5 dbms_output.put_line(v_ename);
6 end;
7 /
TURNER
PL/SQL procedure successfully completed.Demo shellscript (borrowing the function idea from Saubhik):
#!/bin/ksh
empno=${1:-NULL}
exec_sql() {
sqlplus -s william/w@//vm.starbase.local:1521/eleven <<END_SQL
spool get_out_value.sh.log
set serverout on size 2000 feedback off
declare
v_name emp.ename%type;
begin
get_ename(${empno},v_name);
dbms_output.put_line('# ' || v_name);
end;
spool off
exit
END_SQL
ename=$(exec_sql ${empno} | awk '/^# / {print $2}')
print Employee ${empno} = ${ename}Demo:
/Users/williamr: get_out_value.sh 7844
Employee 7844 = TURNER
/Users/williamr: get_out_value.sh
Employee NULL =Note this substitutes the word NULL if no empno is passed, and it ignores error output or anything else by only looking for lines beginning '# ' and then taking the following word. Error messages will appear in the logfile. (In this example it probably doesn't need the NULL substitution because a missing parameter would cause a syntax error which the script will handle anyway, but it could be useful in more complex examples.)
For a production script you should probably use an OS authenticated account so you don't have to deal with password strings. -
How to create procedure for header table and item table
Hi,
Can anyone help me to understand how to write SQLscript procedure for looping item table inside header table?
I fetch records from sales header table ( order number ) and using that order number to loop sales item table,thereafter I need to perform business logic.
Any example similar above requirement would be helpful
thanks
SouravHi Folks,
This is my use case
1) Select fact records from tables (say A,B,C,D ) with suitable Joins and certain Where conditions
SELECT ordid FROM TABLES A,B,C,D on join condition where ....
2) Using above header records , I have to select each and every item level data from different tables ( say X,Y,Z ) and perform calculation to derive new columns to update a new table ( Zreport )
UPDATE TABLE ZREPORT
SET col1 = ( Select qty FROM TABLE X WHERE ordid = A.ordid
UPDATE TABLE ZREPORT
SET col2 = ( Select price FROM TABLE y WHERE ordid = B.ordid.
and so on for other columns..
3) Zreport table will be used for reporting.
I would like to know the best way to achieve this to gain performance.
Appreciate the help!
Thanks
Sourav -
Hi,
Is it possible to configure release procedure for MRP generated PRs?
Regards,
Supriya.Hi Supriya,
1. Create a Characteristic Value with the Table name CEBAN and Field ESTKZ (Creation indicator)
2. Assign the above to a Class
In the Char Value, select 'B' as the option as it refers to MRP created PR.
Hope this will be useful for you -
Can i get help on procedures for amending passwords
can any one help me write the procedures for creating user as well as amending the paaswords of userS??
can any one help me write the procedures for creating user as well as amending the paaswords of userS??
Maybe you are looking for
-
Hello friends, Is it possible to decide at runtime to which web application server the request should send to depending on one of field in sender file? e.g in file adapter we could specify the file name at runtime. I am not sure whether would it be p
-
Need an encryption software for MAC n XP
does anyone know a good encryption USB software that will work on both MAC and XP?
-
Is there anything in SWTOOLS that I actually need to keep?
The SWTOOLS is taking up 3-4 Gigs -- and since I'm using a SSD (with relatively limited space) I'd like those 3-4 Gigs back. Is there anything I actually need in there? If I copy the SWTOOLS folder to a network share, and then delete it from my X220,
-
Payment Method mandatory in FB60/MIRO/F-43
Dear All, We want to pick up default Payment method from Vendor Master and populate in Invoice FB60 or MIRO or F-43,etc. Also let me know how can i set the Payment Metod feild as mandatory,so that the user has to update the PAYMENT METHOD field befor
-
Stalonetray + Openbox = border?
hey all im using Openbox + stalonetray and i have stalonetray set to be transparent and started with the stalonetray -w command to be able to control it with obconf but it shows up with a 2px border around it that i cannot get rid of and if i do the