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.

Single column foreign key and left join - result depends from select column list

FilipFryOct 18 2013 — edited Oct 20 2013

create table test_fk(c1 date primary key deferrable);

create table test_fk1(b1 date references test_fk(c1) deferrable);

alter session set constraints=deferred;

insert into test_fk1 values(sysdate);

insert into test_fk1 values(sysdate);

insert into test_fk1 values(sysdate);

SELECT t1.C1, t.B1 FROM TEST_FK1 t LEFT JOIN TEST_FK t1 ON (t1.C1 = t.B1) WHERE t1.C1 IS NULL AND t.B1 IS NOT NULL;

C1                     B1                  

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

                       18-OCT-2013 16.38.43  

                       18-OCT-2013 16.38.48  

                       18-OCT-2013 16.38.46 

SELECT t.B1 FROM TEST_FK1 t LEFT JOIN TEST_FK t1 ON (t1.C1 = t.B1) WHERE t1.C1 IS NULL AND t.B1 IS NOT NULL;

no rows selected

Comments

Glen Conway

This question has been asked before, and it seems like sqlcl still has an issue with running in the background as opposed to the expected behavior when using sqlplus ( as discussed in How can I run sql script in background? )

However a more recent discussion proposes a workaround which uses javascript to run the sql in the background of your current sqlcl session: run a script in the background ??

Hope this helps

Gaz in Oz

any fixable solution for this ?

No.

Workarounds, yes.

. screen

. tmux

. vncserver / vncclient

...etc.

The issue with sqlcl, I believe, is the way it has been written whereby is incompatible with being put into the background "as is" with nohup, &, bg, so needs a helper process, offered by something like the above.

User_LQWCM

Hi all,

The problem is that sqlcl uses the bash commands to detect the terminal width and  height. Since this only works on Linux, this problem won't exist on Windows.

Inside SQLcl there is a condition that checks whether the program is running on Windows and if so, it does not check the terminal size. It uses system property "os.name" for that so you can do a little hack and provide the value of that property on java command line -Dos.name=win. SQLcl is started from sql command in bin directory so just adding the property as below should work.

$JAVA  $CUSTOM_JDBC $CYGWIN "${APP_VM_OPTS[@]}" -client $DEBUG -Dos.name=win -cp "$CPLIST" oracle.dbtools.raptor.scriptrunner.cmdline.SqlCli "$@"

Regards,

Tomas

User_LQWCM

I apologise, the fix I was proposing above won't work as there are several other dependencies on "os.name" throughout the call, also os.name should be "Windows 8.1" or alike, "win" is invalid.

My problem was that when running this in background from python the sqlcl code around terminal was causing the issues. I fixed it by allocating a dedicated TTY for the process. 

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

Post Details

Locked on Nov 17 2013
Added on Oct 18 2013
11 comments
882 views