UrbanPro
true

Find the best tutors and institutes for Oracle PL/SQL

Find Best Oracle PL/SQL

Please select a Category.

Please select a Locality.

No matching category found.

No matching Locality found.

Outside India?

Search for topics

How To Create The Java Souce In Oracle PLSQL?

Murali Krishna
30/06/2017 0 0

Requirement: How to find the list of files in specified directory?

Step1 : First find the JDK Install or not in the oracle, to find jdk version please run the below sql.

SELECT  dbms_java.get_ojvm_property(PROPSTRING=>'java.version') FROM dual

Step2: Once get the output above then only we can create the java source. If the output is diaplyed then perform the below task

CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED "list_of_files" AS

import java.io.File;

public class list_of_files {

public static String getFileList(String idir)

// public static void main(String[] args)
{
//System.out.println("testing");

File aDirectory = new File(idir);
File[] filesInDir = aDirectory.listFiles();
String result = "";
for ( int i=0; i<filesInDir.length; i++ )
{
if ( filesInDir[i].isFile()
&& !filesInDir[i].isHidden() )
{
result = result + "," +filesInDir[i].getName();
System.out.println("result="+result);

}
}
return result;
}

}

--------------------------------

Compile the above code.

3. create or replace function test_fun(p_dir varchar2) return varchar2
AS LANGUAGE JAVA NAME
'list_of_files.getFileList(java.lang.String) return String';

----------------

Compile the above code

4.select test_fun('c:\jars') from dual;

 run the above sql command.

 

 

 

 

 

 

0 Dislike
Follow 0

Please Enter a comment

Submit

Other Lessons for You

How does a SQL Query Execute inside Oracle? What are the steps followed in the background?
The above snapshot says it all. Hence it is said, 'Picture says it all'. Basically, there are 4-5 steps. There are two possible ways of query being executed. 1. Soft Parse- Improves performance....

Gavi Y. | 05/01/2020

0 0
0

Interview questions based on "level", a pseudocolumn
1. Write a query to get the below output, 1 11 21 31 .. .. 91 2 12 22 32 .. .. 92 3 13 23 33 .. .. 93 .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. 10 20 30 40 ...

Gavi Y. | 05/01/2020

0 0
0

How To Return a Result Set from a Stored Procedure
One of the easiest ways to tackle such Real Time scenarios is through use of Oracle Defined "SYS_REFCURSOR" or "REF CURSOR". We can create a Procedure with an out parameter of Type SYS_REFCURSOR and in...
S

Sagar Sahoo | 22/02/2017

0 0
0

Amazon written test for experience
For the below written test answer I defined with "*" at the end of the options NULL is the same as 0 for integer the same as blank for character * the same as 0 for integer and blank for character the...

Suresh | 13/02/2017

0 0
0

Introduction to Performance tuning
What is Performance in general terms? Throughput per Input. For Eg: we keep saying, this bike has so and so much of mileage and all that. That is one of the parameters in measuring the performance of...

Gavi Y. | 29/01/2017

0 0
0

Looking for Oracle PL/SQL ?

Find best Oracle PL/SQL in your locality on UrbanPro.

Are you a Tutor or Training Institute?

Join UrbanPro Today to find students near you
Sponsored
X

Looking for Oracle PL/SQL Classes?

Find best tutors for Oracle PL/SQL Classes by posting a requirement.

  • Post a learning requirement
  • Get customized responses
  • Compare and select the best

Looking for Oracle PL/SQL Classes?

Find best Oracle PL/SQL Classes in your locality on UrbanPro

Post your learning requirement

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 7.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more