Skip to Main Content

APEX

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.

Error PL/SQL: ORA-00923: FROM keyword not found where expected

KAISSERSep 1 2015 — edited Sep 1 2015

Hello everyone,

I get this error when I generate the code bellow mentioned.

Error computing item default value for page item P1_JORNADA_ANUAL.

ORA-06550: line 42, column 17: PL/SQL: ORA-00923: FROM keyword not found where expected ORA-06550: line 8, column 1: PL/SQL: SQL Statement ignored


Code:


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

DECLARE

  L_EMPRESA B_LISTA_EMPLEADOS.EMPRESA%TYPE;

BEGIN

select  case when ((select EMPRESA

                   from   B_LISTA_EMPLEADOS

                   where  USERNAME = v('APP_USER'))) = 'EMPRESA1'

                then ((select to_char(JORNADA_ANUAL)

                       from B_JORNADAS_Y_RATIOS

                       where  CATEGORIA = ((

                                            select CATEGORIA

                                            from B_LISTA_EMPLEADOS

                                            where USERNAME = v('APP_USER')

                                            ))

                              and EMPRESA = ((

                                              select EMPRESA

                                              from B_LISTA_EMPLEADOS

                                              where USERNAME = v('APP_USER')

                                              ))

                              and ANO = v('P1_ANO')

                              ))

            when ((select EMPRESA

                   from   B_LISTA_EMPLEADOS

                   where  USERNAME = :APP_USER)) = 'EMPRESA2'

                then 'Jornada de EMPRESA2'

            when ((select EMPRESA

                   from   B_LISTA_EMPLEADOS

                   where  USERNAME = :APP_USER)) = 'EMPRESA3'

                then 'Jornada de EMPRESA3'

            else 'Empresa desconocida'

        end

into L_EMPRESA

as Jornada

from B_JORNADAS_Y_RATIOS

group by EMPRESA

RETURN L_EMPRESA;

EXCEPTION

  WHEN NO_DATA_FOUND THEN

  RETURN NULL;

END;

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


Does someone know which or where is the mistake?


Thank you very much.


Regards


This post has been answered by Jagadekara on Sep 1 2015
Jump to Answer

Comments

Dude!
Most likely there is nothing wrong with the OS, but how the user was created. A user under Linux is normally created using "useradd" program, which will copy files from the /etc/skel directory like .bash_logout, .bash_profile and .bashrc. You need "ls -a" to list hidden files starting with a . (dot).

According to the bash man page, Bash first reads and executes commands from the file /etc/profile, if that file exists. After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable. When an interactive shell that is not a login shell is started, bash reads and executes commands from /etc/bash.bashrc and ~/.bashrc, if these files exist.
EdStevens
Answer
GabyPR wrote:
I installed Oracle Linux 5.7. I need to view the .bash_profile file or whatever file Oracle Linux uses to store the environment variables for a user. I am working with the "oracle" user whose home directory is /home/oracle.
Connected as "oracle" I issued the "env" command and many variables are shown to have been set already.
I issue the export command to set the PATH variable and the changes are shown when I issue the "env" command.

So everything seems to be working but I don't find where all those settings are stored. I went to the /home/oracle directory and I only saw a .bash_history file. So I created a new file named .bash_profile, but the variables are not stored there when I issue the export command. (the file I created was before I noticed that variables are already being set somewhere else - on a file I did not find).
They aren't 'stored' anywhere. Well, they are stored in memory, for the session in which the 'export' command was executed. The .profile (or .bash_profile) is executed by the OS when the owning user first logs on. It is not (as your question seems to imply) updated when you execute an 'export' command. You need open the .profile and put those export commands into the file, so that they get executed when you log on.
So where are they ??? The only thing I need to know is how to locate the file the system is using right now to store the environment variables, I supposed it has to be located under the $home directory for the user but it seems it is not that way. Anybody knows something about this ??

The /etc/profile file I understand is a general file for global settings, so it's not what I'm looking for as far as I know.

here's the output of the env command issued connected as "oracle" ... I need to know on what file they are stored.

bash-3.2$ env

SSH_AGENT_PID=8782
HOSTNAME=Oracle.Linux
DESKTOP_STARTUP_ID=
TERM=xterm
SHELL=/bin/bash
HISTSIZE=1000
KDE_NO_IPV6=1
GTK_RC_FILES=/etc/gtk/gtkrc:/home/oracle/.gtkrc-1.2-gnome2
WINDOWID=25165905
QTDIR=/usr/lib/qt-3.3
QTINC=/usr/lib/qt-3.3/include
USER=oracle
LS_COLORS=
GNOME_KEYRING_SOCKET=/tmp/keyring-EbBsIZ/socket
SSH_AUTH_SOCK=/tmp/ssh-OcrBnl8746/agent.8746
KDEDIR=/usr
SESSION_MANAGER=local/Oracle.Linux:/tmp/.ICE-unix/8746
USERNAME=oracle
MAIL=/var/spool/mail/oracle
PATH=/usr/lib/qt-3.3/bin:/usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin
DESKTOP_SESSION=default
GDM_XSERVER_LOCATION=local
INPUTRC=/etc/inputrc
PWD=/home/oracle
XMODIFIERS=@im=none
KDE_IS_PRELINKED=1
LANG=en_US.UTF-8
GDMSESSION=default
SSH_ASKPASS=/usr/libexec/openssh/gnome-ssh-askpass
SHLVL=2
HOME=/home/oracle
GNOME_DESKTOP_SESSION_ID=Default
LOGNAME=oracle
QTLIB=/usr/lib/qt-3.3/lib
CVS_RSH=ssh
DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-dgt3DUIWif,guid=bb5dcea335860598b6a290004f42d4f7
LESSOPEN=|/usr/bin/lesspipe.sh %s
DISPLAY=:0.0
G_BROKEN_FILENAMES=1
COLORTERM=gnome-terminal
XAUTHORITY=/tmp/.gdmR05GAW
_=/usr/bin/env
bash-3.2$
Marked as Answer by GabyPR · Sep 27 2020
GabyPR
You clarified me about my thinking of that I thought the profile file is like a configuration file, like a "pfile" in Oracle.
But I see it's not that way. Anyway I wonder why I had to create a blank file name .bash_profile under the home directory, I thought Linux would create a "default" one there with that name. Anyway I will enter some instructions and export commands there to see if they are implemented, ie, to see if Linux is reading it at login.

Thanks so much for your help
Gabriel
Dude!
Sorry, but your conclusion is wrong. The login-profile files serve a very similar purpose to the command shell like the "pfile" to the Oracle Instance, albeit using a different command syntax.

The reason why you do not have a .bash_profile file, like I tried to explain earlier, is most likely because you probably did not use the "useradd" command to create the oracle user or deleted the file by accident. You can copy the files from /etc/skel, e.g. cp /etc/skel/.bash_profile $HOME

The Oracle installer will setup variables necessary for the Oracle DBA like ORACLE_HOME, etc. These variables are not stored in any of the login profile files, but they can be generated by source executing the Oracle "oraenv" utility. It's covered in the Oracle database installation manual.
EdStevens
GabyPR wrote:
You clarified me about my thinking of that I thought the profile file is like a configuration file, like a "pfile" in Oracle.
But I see it's not that way. Anyway I wonder why I had to create a blank file name .bash_profile under the home directory, I thought Linux would create a "default" one there with that name. Anyway I will enter some instructions and export commands there to see if they are implemented, ie, to see if Linux is reading it at login.

Thanks so much for your help
Gabriel
You're not in Kansas (Windows) any more. Unlike Windows, nix does not try to be smarter than the user, does not try to (wrongly) anticipate what the user wants. On the other hand, you'll not have to restart every day. Unlike Windows, in nix the first three troublshooting steps are NOT "ctrl", "alt", and "del".
1 - 5
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Sep 29 2015
Added on Sep 1 2015
7 comments
10,000 views