Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6799629
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:52:16+00:00 2026-05-26T18:52:16+00:00

I have a query in java string. What i need to do is fire

  • 0

I have a query in java string. What i need to do is fire that query by jdbc.
Query is:

String strQuery= " CREATE OR REPLACE FUNCTION GET_CLOSE_DATE ( PARAM_DOCUMENT_ID IN NUMBER ) 
     RETURN DATE AS
      V_CLOSE_DATE DATE;
     BEGIN
       SELECT MAX(TOP_LEVEL_ELEMENT.CLOSE_DATE_TIME) INTO V_CLOSE_DATE  
       FROM TOP_LEVEL_ELEMENT  WHERE TOP_LEVEL_ELEMENT.DOCUMENT_ID = PARAM_DOCUMENT_ID; 
       RETURN V_CLOSE_DATE; 
     END GET_CLOSE_DATE;";

I am using JDBC

Statement stmt = con.createStatement();
stmt.executeUpdate(strQuery);

The query gets executed successfully but when I try to use this function it throws an an exception saying the GET_CLOSE_DATE function is in invalid state. I have also tried firing

alter function GET_CLOSE_DATE compile;

immediately after firing the create function query. Both are executed successfully but still the the function remains in invalid state. Please suggest some solutions.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T18:52:17+00:00Added an answer on May 26, 2026 at 6:52 pm

    Try this command to see what, if any errors are associated with this function:

    SELECT * 
      FROM user_errors 
     WHERE name = 'GET_CLOSE_DATE';
    

    EDIT:

    It might be the embedded CR/LF’s in your string. Try concatenating your SQL string, as in:

    String strQuery= " CREATE OR REPLACE FUNCTION GET_CLOSE_DATE ( PARAM_DOCUMENT_ID IN" +
                     " NUMBER) RETURN DATE AS " +
                     " V_CLOSE_DATE   DATE " +
    ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a java.sql.ResultSet object containg data from a query that was run. How
I have a query that will need to run 28 000 times in a
I have the following Java 6 code: Query q = em.createNativeQuery( select T.* +
I have the following simple Java code: package testj; import java.util.*; public class Query<T>
I am using in C# MYsql .I have query that works if I run
I've noticed that a few Wordpress blogs have query statistics present in their footer
I have a query that is dynamically built after looking up a field list
I have a query that originally looks like this: select c.Id, c.Name, c.CountryCode, c.CustomerNumber,
I have a query that looks like this: public IList<Post> FetchLatestOrders(int pageIndex, int recordCount)
I have a XML string comming from a Rest WS that I created on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.