Sign Up to our social questions and Answers to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers to ask questions, answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Can I use If statement inside Where clause in oracle SQL?
hello oracle user, you can use CASE statement same like IF ex: [code] WHERE e.status = (CASE WHEN status_flag = STATUS_ACTIVE THEN 'A' WHEN status_flag = STATUS_INACTIVE THEN 'T' ELSE null END) AND e.business_unit = (CASE WHEN source_flag = SOURCE_FUNCTION THEN 'production' WHEN source_flag = SOURCERead more
hello oracle user,
you can use CASE statement same like IF ex:
[code]
See lessWHERE e.status = (CASE WHEN status_flag = STATUS_ACTIVE THEN ‘A’
WHEN status_flag = STATUS_INACTIVE THEN ‘T’
ELSE null END)
AND e.business_unit = (CASE WHEN source_flag = SOURCE_FUNCTION THEN ‘production’
WHEN source_flag = SOURCE_USER THEN ‘users’
ELSE null END)
[/code]
How to handle a unique constraint exceptions in PL/SQL code?
hello, you can use exception : [code] EXCEPTION WHEN DUP_VAL_ON_INDEX [/code]
hello,
you can use exception :
[code]
See lessEXCEPTION
WHEN DUP_VAL_ON_INDEX
[/code]
How to rollback oracle sequence value ?
There is no way to rollback the generated sequence. To restart the sequence at a different number, you must drop and re-create it. See http://docs.oracle.com/cd/B19306_01/server.102/b14200/statements_2011.htm. If you change the INCREMENT BY value before the first invocation of NEXTVAL, some sequenceRead more
There is no way to rollback the generated sequence.
To restart the sequence at a different number, you must drop and re-create it. See http://docs.oracle.com/cd/B19306_01/server.102/b14200/statements_2011.htm.
If you change the INCREMENT BY value before the first invocation of NEXTVAL, some sequence numbers will be skipped. Therefore, if you want to retain the original START WITH value, you must drop the sequence and re-create it with the original START WITH value and the new INCREMENT BY value.
See lessHow to open a PDF output directly when click of a SubmitButton in OAF ?
Hi Waqas, it's applicable by using Standard API [code]fnd_webfile.get_url (file_type => fnd_webfile.request_out, -- for output file. Use request_log to view log file ID => l_request_id, gwyuid => l_gwyuid, two_task => l_two_task, expire_time => 500 -- minutes, security!. );[/code] notRead more
Hi Waqas,
it’s applicable by using Standard API
[code]fnd_webfile.get_url
(file_type => fnd_webfile.request_out,
— for output file. Use request_log to view log file
ID => l_request_id,
gwyuid => l_gwyuid,
two_task => l_two_task,
expire_time => 500 — minutes, security!.
);[/code]
note : there are two profile options this API must take as following
l_gwyuid : Gateway User ID
[code]oadbtransactionimpl.getAppsContext().getEnvStore().getEnv(“GWYUID”)[/code]
l_two_task: Two Task(TWO_TASK)
[code]oadbtransactionimpl.getAppsContext().getEnvStore().getEnv(“TWO_TASK”)[/code]
you can register out parameter of calling this API to String variable then use
[code]pageContext.sendRedirect[/code]
Hope this helpful 🙂
How to Put session parameter on link oracle OAF ?
Hello Aashish, There are three common means of passing parameters between pages : Request Transaction Session and you can use VO attributes for passing values Values stored in VO attributes are available in all pages within the transaction with same Root AM. URL Parameters : Encryption and EncodingRead more
Hello Aashish,
There are three common means of passing parameters between pages :
Request
Transaction
Session
and you can use VO attributes for passing values
Values stored in VO attributes are available in all pages within the transaction with same Root AM.
URL Parameters : Encryption and Encoding
When we are passing parameters in URL, following need to be considered:
[code]
See less{@Attr} – encodes. Changes Prince Kapoor to Prince%20Kapoor
{!Attr} – encrypts. Encrypts sensitive information.
{$Attr} – plain token substitution (no encoding or encryption)
{@@RETURN_TO_MENU} – Used for E-Business Suite Personal Home Page. Same as OAWebBeanConstants.RETURN_TO_MENU_URL.
{@@RETURN_TO_PORTAL} – Return the user to a launching Portal page. Same as OAWebBeanConstants.RETURN_TO_PORTAL_URL.
[/code]
How to query a CLOB column in Oracle SQL ?
Hi Albert, You can use DBMS_LOB.substr like this for example: DBMS_LOB.substr(column, 3000) but don't forget that substring of a CLOB column has size/buffer restrictions sometimes you would need to set the BUFFER to a larger size. For example while using SQL Plus use the SET BUFFER 10000 to set it tRead more
Hi Albert,
You can use DBMS_LOB.substr like this for example:
but don’t forget that substring of a CLOB column has size/buffer restrictions sometimes you would need to set the BUFFER to a larger size.
For example while using SQL Plus use the SET BUFFER 10000 to set it to 10000 as the default is 4000
and you can refer to Oracle Substr Function Article for more information about the substr function
See lessError ORA-00933: SQL command not properly ended – update
hello, here you can find the cause and action to correct your statement : Cause: The SQL statement ends with an inappropriate clause. For example, an ORDER BY clause may have been included in a CREATE VIEW or INSERT statement. ORDER BY cannot be used to create an ordered view or to insert in a certaRead more
hello,
here you can find the cause and action to correct your statement :
Cause: The SQL statement ends with an inappropriate clause. For example, an ORDER BY clause may have been included in a CREATE VIEW or INSERT statement. ORDER BY cannot be used to create an ordered view or to insert in a certain order.
Action: Correct the syntax by removing the inappropriate clauses. It may be possible to duplicate the removed clause with another SQL statement. For example, to order the rows of a view, do so when querying the view and not when creating it. This error can also occur in SQL*Forms applications if a continuation line is indented. Check for indented lines and delete these spaces.
you can use :
[code]
UPDATE employees e
SET e.last_name = ‘test’
WHERE e.department_id = (SELECT d.department_id
FROM departments d
WHERE d.department_id = e.department_id);
[/code]
Return more than one row from stored procedure in pl/sql
hello aya, as you know the procedure you can't use inside query so if you need to create procedure to return multiple row or values you can use : create or replace procedure myprocedure(retval in out sys_refcursor) is begin open retval for select employee_id,last_name from employees; end myprocedureRead more
hello aya,
as you know the procedure you can’t use inside query so if you need to create procedure to return multiple row or values you can use :
create or replace procedure myprocedure(retval in out sys_refcursor) is
begin
open retval for
select employee_id,last_name from employees;
end myprocedure;
and here you can call procedure inside anonymous pl/sql block :
[code]
DECLARE
myrefcur SYS_REFCURSOR;
employee_id employees.employee_id%TYPE;
last_name employees.last_name%TYPE;
BEGIN
myprocedure (myrefcur);
LOOP
FETCH myrefcur INTO employee_id,last_name;
EXIT WHEN myrefcur%NOTFOUND;
DBMS_OUTPUT.put_line (‘Employee Id: ‘ || employee_id || ‘ Last Name: ‘|| last_name);
END LOOP;
CLOSE myrefcur;
END;
[/code]
hope this help.
See lessHow to Create the TKPROF Trace File in oracle ?
Hello , Solution : For the TKPROF a) tkprof rawtrace.trc output_file explain=apps/apps/sort=(exeela,fchela) sys=no b) rawtrace.trc: Name of trace file output_file: tkprof out file explain: This option provides the explain plan for the SQL statements sort: This provides the sort criteria in which allRead more
Hello ,
Solution :
a) tkprof rawtrace.trc output_file explain=apps/apps/sort=(exeela,fchela) sys=no
b) rawtrace.trc: Name of trace file
output_file: tkprof out file
explain: This option provides the explain plan for the SQL statements
sort: This provides the sort criteria in which all SQL statements will be sorted. This will bring the bad SQL at the top of the outputfile.
sys=no: Disables SQL statements issued by user SYS
Regards ,
Mahmoud Morsy
See lessHow to see lock on table and query?
Hi Mina , Try this query : [code] SELECT c.owner, c.object_name, c.object_type, b.sid, b.serial#, b.status, b.osuser, b.machine FROM v$locked_object a, v$session b, dba_objects c WHERE b.sid = a.session_id AND a.object_id = c.object_id AND xidsqn != 0; [/code] Regards , Mahmoud Morsy
Hi Mina ,
Try this query :
[code]
SELECT c.owner,
c.object_name,
c.object_type,
b.sid,
b.serial#,
b.status,
b.osuser,
b.machine
FROM v$locked_object a, v$session b, dba_objects c
WHERE b.sid = a.session_id AND a.object_id = c.object_id AND xidsqn != 0;
[/code]
Regards ,
Mahmoud Morsy
See less