Search This Blog

Sunday, July 23, 2017

Select Second Height Value/ Salary from a Table

SELECT *
  FROM (SELECT e.* ,ROW_NUMBER () OVER (ORDER BY salary DESC) rn
          FROM employees e)
 WHERE rn = 2;

Thursday, July 20, 2017

Create Validation

Code Editor PL/SQL Function Body Returning Error Test:

declare
v_test varchar2(50);
begin
select last_name into v_test from employees where last_name= :P4_LAST_NAME ;
if
v_test IS  NULL then
return null ;
else
return 'This name is not available' ;
end if;
exception
when others then
return null ;
end ;

Wednesday, July 19, 2017

Login Authentication on Oracle Apex 5

Hi
Today I am going to write about how to do LOGIN AUTHENTICATION   

1. Go to apex default login page then >> go to dynamic action call login >> PL/SQL Code
Now copy the name of this two parameter.
p_username
p_password


2. Now create a function using this tow parameter.
Here I do a function using EMPLOYEES TABLE
and I assume EMPLOYEE_ID AS PASSWORD AND FIRST_NAME AS USERNAME

   CREATE OR REPLACE FUNCTION LOGIN_FUNC (p_username   VARCHAR2,
                                       p_password   NUMBER)
   RETURN BOOLEAN
IS
   VAL_TEST   NUMBER;
BEGIN
   SELECT 1
     INTO VAL_TEST
     FROM EMPLOYEES 
    WHERE     UPPER (first_name) = UPPER (p_username)  -- (obviously use upper function  to make the function more ----- efferent )   
          AND employee_id = p_password;    

   RETURN TRUE;

EXCEPTION
   WHEN NO_DATA_FOUND
   THEN
   
      RETURN FALSE;
      
END; 

3. Now go to application page to >>Edit Application Properties >>Security >> (Authentication) Define Authentication Schemes >> Create >> Based on a pre-configured scheme from the gallery AND CLICK NEXT >> type a name>>Scheme Type --CUSTOM >>Authentication Function Name (HERE YOU RIGHT NAME OF YOUR FUNCTION WHAT YOU WRIGHT FOR AUTHENTICATION

THAT'S END

NOW YOUR PAGE AUTHENTICATION WILL WORK.
YOU CAN LOGIN USING ANY EMPLOYEE  FIRST_NAME AND EMPLOYEE_ID ;

THANK YOU
(Value Required) 

Monday, July 17, 2017

Install and Uninstall Oracle Apex

To install apex your PC have must oracle setup

1.  open CMD with adminstrator

2.  goto the path of apex software using CMD command like
     CD D:/apex

3.  goto sqlplus and login with sys as sysdba

4.  select name from v$datafile

5. CREATE TABLESPACE apex DATAFILE 'C:\ORACLEXE\APP\ORACLE\ORADATA\XE\apex.dbf' SIZE 10M  AUTOEXTEND      ON NEXT 1M;
    (Here we create a table space for apex application) 

6. @apexins.sql APEX1 APEX1 TEMP /i/ (***This i must be lower case!!!)

7. @apxchpwd.sql   for password set

8. @apxldimg  F:\apex1  ( load images what u use in apex)

9.  ALTER USER ANONYMOUS ACCOUNT UNLOCK ; (unlock nonymous user)

10. @apxlding.sql D: ( images load confirm) 

11.  EXEC DBMS_XDB.sethttpport(8080) ; (makeing a port for apex you can      take any port number)

 

Remove/ Uninstall Apex:

$ sqlplus /nolog

SQL> connect / as sysdba

Connected.SQL> @apxremov.sql

PL/SQL procedure successfully completed.


…Application Express Removed

How to hide drive from cmd and How to make a boot able pen drive

How to hide drive from cmd:
Go to CMD: diskpart

:list volume
:select volume (number of volume; like 3)
:remove letter (name of volume; like e)

To retrieve :
select volume (number of volume; like 3)
:assign 

it will back successfully .

How to make a boot able pen drive: 
cmd: diskpart
:list disk
:select disk (number of your pen drive like; 1) (Please be careful to select disk, Disk 0 is always may hard disk) 
:clean ( to format all )
:create partition primary
:active
:format fs=fat32 quick
:assign

Sunday, July 16, 2017

Type of Triangle

Write a query identifying the type of each record in the TRIANGLES table using its three side lengths. Output one of the following statements for each record in the table:
  • Equilateral: It's a triangle with  sides of equal length.
  • Isosceles: It's a triangle with  sides of equal length.
  • Scalene: It's a triangle with  sides of differing lengths.
  • Not A Triangle: The given values of AB, and C don't form a triangle.
Input Format
The TRIANGLES table is described as follows:
Each row in the table denotes the lengths of each of a triangle's three sides.
Sample Input
Sample Output
Isosceles
Equilateral
Scalene
Not A Triangle
Explanation
Values in the tuple  form an Isosceles triangle, because 
Values in the tuple  form an Equilateral triangle, because . Values in the tuple form a Scalene triangle, because 
Values in the tuple  cannot form a triangle because the combined value of sides  and  is not larger than that of side .

SOLUTION :
SELECT CASE WHEN A + B > C AND A+C>B AND B+C>A THEN 
CASE WHEN A = B AND B = C THEN 'Equilateral' 
WHEN A = B OR B = C OR A = C THEN 'Isosceles' 
WHEN A != B OR B != C OR A != C THEN 'Scalene' 
END ELSE 'Not A Triangle' END FROM TRIANGLES;

Tuesday, July 11, 2017

How to Block/Off Edit mood of a Apex application in 5.0/5.1

To block edit mood of a oracle apex application you should follow this steps :
1. Go to   Edit Application Properties
2. Click on Availability
3. Change Build Status as Run Application Only.

Now how to unblock it :

1. Login as  Admin of the user.
2. Application Build St.....
3. Change Build Status as Run and Edit Application .

Monday, July 10, 2017

How to upload Image from Form and Show it in Report on Oracle apex 5.1 version

It is very easy to upload a image in form and show it in form. Here I give the sequence of task to do.

1. First add a column for IMAGE  with BLOB type.
2. Create a report and it's data inserting form where there will be a FILE BROWSER type option for       Image.
3. Select on REPORT then go to Properties then Code Editor - SQL Query
4. Then Add [ dbms_lob.getlength(Column Name) img ] respective of IMAGE column.
5. And finally select on IMAGE column then goto properties and change type as DISPLAY IMAGE

at the end save and run.
Now upload image and see it on your report.
Thank You.

Saturday, July 8, 2017

Easy way to understand and catch a PL/SQL Procedure ( 7 step of a Procedure)

How to understand and memorize a PL/SQL Procedure?
Procedure Using Multiple OUT mood parameter .

Watching this 10 steps of a PL/SQL Procedure you can very easily understand and memorize a Procedure format.


1. create or replace Procedure P_emp_name  --(Procedure Name)
2. (e_id in number, f_na out varchar2, l_na out varchar2)  --(Parameter Using IN/ OUT )
3. declare --(if needed)
3. IS --(IS/AS)
4. begin --(Execution)
5. select first_name, last_name /*5.1 */ into f_na, l_na  --(Passing value into the variable using INTO )
from employees
where employee_id=e_id ;
6.exception ; --(Exception if needed with ;)
7. end ;  --(End with ;)

EXECUTE: 

declare
f varchar2(50);
la varchar2(50);
begin
P_emp_name(100,f,la);
dbms_output.put_line('Name:' || f || '  ' || la);
end;
/

Remember There are  10 Step in a Function 

Easy way to understand and catch a PL/SQL Function ( 10 step of a Function)

How to understand and memorize a PL/SQL Function ?

Watching this 10 steps of a PL/SQL function you can very easily understand and memorize a Function  format.

1.create or replace function f_name  --(name of function)
2.(peramiter /*(2.1 ) in/out/in out */ in number) --(Parameter )
3.return varchar2 -- (Return)
4.IS --( use of IS or AS)
5.v varchar2(200) ; --(Declare variable if needed with ;)
6.begin --(Execution)
7.select first_name into v -- (Passing value into the variable using INTO )
   from employees
   where employee_id=n ;
8.return v ; --(Return value with ;)
9. exception ; --(Exception if needed with ;)
10. end ; --(End with ;)

To run the function: 

select last_name , f_name(100) from employees
where employee_id=198;


Remember There are  10 Step in a Function 

Wednesday, July 5, 2017

iReport-5.6.0 Install successfully but not open.

It is a very common problem that Jespersoft iReport-5.6.0 Designer install successfully but do not open.
It can not open because of JDK version. Now a days latest version of JDK is 1.8 but unfortunately "jespersoft iReport-5.6.0" unable to support 1.8.
In JDK version 1.7 is suitable.
1. download JDK version 1.7  like "jdk-7u76-windows-(32bit/64bit)" and install.
2. Then go to this path in your PC installation "C:\Program Files\Jaspersoft\iReport-5.6.0\etc" and open "ireport.conf" with any test editor.
                               Click On the Image for Good Quality 

(Given image may help you to understand)
3. Now add (jdkhome="path of your jdk 1.7") this line
after this (#jdkhome="/path/to/jdk")
4. Finally save it in same place. ( After edit the file may not save in the same place so save it some where else and copy past on the same path with same name)
In Sha Allah the problem will solved.

PDF to Text Covert by Oracle Apex

Here are the steps to convert and get the character into a region by Oracle Apex. Step1.  Create a page and Copy-Pest the below code into Pa...