import java.sql.*;

public class ProcCall extends Thread
{
    public static void main(String[] args)
    {
		Connection con = null;
		String procCall = null;
		String result = null;

		procCall = args[0];

		try {
			Class.forName("org.postgresql.Driver");
			
			con = DriverManager.getConnection("jdbc:postgresql:GSC=//st19:5432/gsc@testdb", "snaga", "snaga");

			Statement stmt = null;
			ResultSet rs = null;

			stmt = con.createStatement();

			/*
			 * Procedure Call
			 */
			rs = stmt.executeQuery("SELECT " + procCall + " FOR UPDATE");

			if ( rs!=null && rs.next() )
			{
				result = rs.getString(1);
			}

			rs.close();
			stmt.close();
			con.close();
		}
		catch (Exception e)
		{
			System.err.println( e.getMessage() );
			System.exit(-1);
		}

		System.out.println(result);
    }
}
