Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Using calculated column names in SELECT query

Vysakh Suresh - 3035408Apr 13 2016 — edited Apr 14 2016

Dear All,

I created a table test_table_1..

CREATE TABLE test_table_1(col_1_val NUMBER(20));

Inserted values into it..

INSERT INTO test_table_1

VALUES (1);

We can select value from table as..

SELECT col_1_val

FROM test_table_1;

pastedImage_59.png

To get the same output, Can we select the column name col_1_val from test_table_1 like..

SELECT col_<an expression/formula which evaluates to result 1>_val

FROM test_table_1;

Thanks and Regards,

Vysakh Suresh

This post has been answered by odie_63 on Apr 14 2016
Jump to Answer

Comments

InoL

>It works fine with CMD directly

On your PC I guess?

HOST runs on the server, not on your PC. Use CLIENT_HOST if you want to run an OS command on your PC.

Something else to consider is that Forms 10 uses Java 1.4.2.  If you wrote your java code in anything newer and the java version being used in the one from the Oracle Home then your code might fail.  However, as mentioned above, if you are expected to run this on the client machine, you will need to use WebUtil (CLIENT_HOST).  Also, you said you were using Forms 10.2.0.  I'm going to guess and say that you probably meant 10.1.2.0.2 since there is no 10.2.  This might be important information later.

usman_noshahi

hello ,

thanks for your reply.

I am using.

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

Forms [32 Bit] Version 10.1.2.0.2 (Production)

Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production

     With the Partitioning, OLAP and Data Mining options

Oracle Toolkit Version 10.1.2.0.2 (Production)

PL/SQL Version 10.1.0.4.2 (Production)

Oracle Procedure Builder V10.1.2.0.2 - Production

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

I using 1.4 version for java program .

i am configuring webUtil please give me syntax example how to use CLIENT_HOST properly to run .jar file

thanks..

CraigB

usman_noshahi wrote:

i am configuring webUtil please give me syntax example how to use CLIENT_HOST properly to run .jar file

The syntax is the same, you just replace HOST with CLIENT_HOST.  For example:

Client_Host('cmd / c start java -jar "D:\SMS\SMS\dist\SMS.jar"');


Just keep in mind that you must add all of the required WebUtil objects to your form in order to use Client_Host.  Refer to the WebUtil documentation or WebUtil Forms Help articles for how to use WebUtil.

Craig...

usman_noshahi

thanks CriagB

I configured webUtil perfectly , (though i have done it before)

my java code is compiled at 1.3 version of JDK in Netbeans IDE.

when codded this

                     Client_Host('cmd / c start java -jar "D:\SMS\SMS\dist\SMS.jar"'); 

at when button pressed trigger it shows me a black window with title :"C:\WINDOWS\SYSTEM32\cmd.exe

remains open and does nothing...

is there any thing which am i missing....

thanks...

CraigB

I recommend you create a batch file and call your Java program from the batch file.  Then call the batch file from Forms using Client_Host.  I've heard of their being problems calling Java directly via Client_Host as you are doing.

Craig...

usman_noshahi

thanks CriagB.

before you posted i have just tried this way ,

when i use same syntax in .bat file , when called from oracle forms it shows me in cmd black window

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

c:\devSuithome_1\forms>java jar "D:\SMS\SMS\dist\SMS.jar"

'java' is not recognized as an internal or external command,

operable program or batch file.

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

other wise .jar file is working very efficiently when i manually type the this " java -jar "file path.jar" "

just one thing is left which calls that .bat file from oracle forms with right description ,

i thing control should go on C:\ instead of c:\devSuithome_1\forms>

please...

thanks

usman_noshahi

i tried all possible ways , calling .jar through .bat , and .jar directly from oracle forms via host(); and client_host();

i am stuck...

please show me the way....

thanks

Andreas Weiden

Try to give the path to java.exe in your batch like

c:\Programs\java\java.exe

usman_noshahi

if you means

c:\prgram\java\java.exe java -jar "D:\SMS\SMS\dist\SMS.jar"

if you means so then its not working too..

Andreas Weiden

And what error does it show? Did you give the right path to java.exe?

usman_noshahi

there is no error Sir,  console just opens and closes very quickly , there is no processing , and the java is installed in c:\program file\<java dir>

i made java.exe shortcut in c:\<maindirectory> because space creates problem in c:\program file\

François Degrelle

You could try to redirect to a text file, maybe it will show you more information:

c:\program\java\java.exe java -jar D:\SMS\SMS\dist\SMS.jar > D:\error.txt

Francois

Tharaka Uchiha
Answer

Hi

Try this

begin

HOST('D:\JAVAPROJ\PROJECT\dist\FILE.jar' );

end;

Marked as Answer by usman_noshahi · Sep 27 2020
usman_noshahi

I tried this code 3 days back but it didn’t work because of environment variables ,

Here is the solution.

Things that was wrong.

  1. Netbeans IDE set variables paths for "java" automatically but “javac” keyword still unrecognized by CMD.
  2. When we call any file using host(); keyword ,  Not setting Environment variable takes the control to the cmd.exe which exists in %devehome%\cmd.exe that couses “java” command not to be recognized .
  3. Wrong command in batch file to run .jar file.

Solution:

  • Set the Enviroment veriable path where jdk is installed. For example

C:\Program Files\Java\jdk1.6.0_30\bin

  • Make new variable named JAVA_HOME and put the same value.

  • Keep java and javac version same .. run this command to verify.

java -version

javac -version

  • Once your commands give you versions details in case if they provide the same output then you can try your batch file just giving your .jar file exect path WITHOUT any qoutation marks or any thing like this

cmd.exe /c start “dirctory”.


  • Just write in your batch direct path like this

D:\filepath\filename.jar

  • Then try to run this batch file directly by double clicking to find if there is no error , for this use this

D:\filepath\filename.jar > d:\error.text

  • Once you verify then launch this file form your oracle forms like this

begin

host('d:\filepath\filename.bat');

end;

during this all time I noticed that oracle form runs .exe file very quickly for this you can made .exe file by using c++ code (use any IDE which you like)

#include "stdafx.h"

#include "stdlib.h"

using namespace System;

int main(array<System::String ^> ^args)

{

      system("D:\\filepath\\filename.bat");

    return 0;

}

Things that to be taken under consideration

Be aware of the order of Environment variables , for example if you have ORACLE ODBC(DATASOURCE) SYSTEM DNS configured then keep the %oraclehomepathBINdirectory%  at first number in class path then put the JDK BIN directory path after this one otherwise ODBC will give you error.

If you don’t have the same versions of java and javac then it will create lot of problems to call another .jar file not only from oracle forms but also from java JFRAMFORM .

thanks.

1 - 15
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on May 12 2016
Added on Apr 13 2016
22 comments
63,682 views