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 8478635
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T18:47:59+00:00 2026-06-10T18:47:59+00:00

According to the HSQL documentation only SQL procedures require CALL syntax. I am writing

  • 0

According to the HSQL documentation only SQL procedures require CALL syntax. I am writing a SQL function but I cannot SELECT from it. I can only CALL it. Can anyone see something I’ve missed? Here is my code

public static void main(String[] args) throws Exception {
    Class<?> driverClass = Class.forName("org.hsqldb.jdbcDriver");
    JDBCDriver driver = (JDBCDriver) driverClass.newInstance();
    Properties props = new Properties();
    props.setProperty("user", "sa");
    props.setProperty("password", "");
    Connection c = driver.connect("jdbc:hsqldb:mem:aname", props);
    execute(c, "CREATE TABLE T (i INT)");
    execute(c, "INSERT INTO T VALUES (1)");
    execute(c, "CREATE FUNCTION f() RETURNS TABLE (i INT) READS SQL DATA " +
            " RETURN TABLE (SELECT * FROM T)");
    System.out.println("Call returns the ResultSet:");
    execute(c, "{ CALL f() }");
    try {
        execute(c, "SELECT * FROM f()");
    } catch (Exception e) {
        System.out.println("Select throws the exception:");
        System.out.println(e);
    }
}

private static void execute(Connection c, String sql) throws SQLException {
    Statement s = c.createStatement();
    try {
        s.execute(sql);
        ResultSet rs = s.getResultSet();
        if (rs != null) {
            printResultSet(rs);
        }
    } finally {
        s.close();
    }
}

private static void printResultSet(ResultSet rs) throws SQLException {
    try {
        while (rs.next()) {
            int columnCount = rs.getMetaData().getColumnCount();
            for (int i = 1; i <= columnCount; i++) {
                System.out.println(rs.getObject(i));
            }
        }
    } finally {
        rs.close();
    }
}

I get the output:

Call returns the ResultSet:
1
Select throws the exception:
java.sql.SQLSyntaxErrorException: user lacks privilege or object not found: F
  • 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-06-10T18:48:00+00:00Added an answer on June 10, 2026 at 6:48 pm

    The correct syntax for selecting the table returned by this function is as follows:

    SELECT * FROM TABLE(F())
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

According to Hibernate documentation : After observing that arrays cannot be lazy , you
According to be Spring Framework documentation, logging is the only mandatory dependency of Spring.
According to the Google App Engine documentation, writing to one entity group is limited
According to select name from system_privilege_map System has been granted: SELECT ANY TABLE ...and
According to w3schools group by needs an aggregate_function(column_name) . SELECT column_name, aggregate_function(column_name) FROM table_name
According to the documentation , socket_read() is supposed to return FALSE when the remote
According to Microsoft , you must sign your ClickOnce application. But it seems to
According to MDN documentation for JSON.stringify : Properties of non-array objects are not guaranteed
According to the PHP Documentation PDO::prepare() adds quotes to all your parameters so that
According to 8.2 The Null Type chapter of Ecma-262 null is type. But typeof(null)

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.