PL/SQL on SquirreL SQL Client 3.7.1 - oracle

I was trying to execute PL/SQL scripts on SQuirrel but it doesn't seem to work.
I configured Oracle Thin Driver by adding ojdbc7.jar on "Extra Class Path", was able to connect to the database but when tried to run a simple code it gives an error:
-- code
BEGIN
dbms_output.put_line('Hello World');
END;
/
-- error
Error: ORA-06550: line 2, column 37:
PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following:
:= . ( % ;
SQLState: 65000
ErrorCode: 6550
Error occurred in:
BEGIN
dbms_output.put_line('Hello World')
Am I doing anything wrong?

This statement worked for me (the / is necessary for SQuirrel SQL Client):
BEGIN
dbms_output.put_line('Hello World');
END;
/
However, you won't see the output in the usual Results tab. You need to open the Oracle Database Output window. As far as I can see you can only open it with a button on the toolbar. You'll also need to enable auto refresh or manually refresh the output.

can you try this:
BEGIN
dbms_output.put_line('Hello World');
END;
by removing /

When installing the SQuirreL, try including the Oracle Plugin. This works for me in version 3.8.1.

Oracle plugin for Squirrel is needed for executing queries in BEGIN - END;
Had the same problem untill reinstalled squirrel with Oracle plugin.

Related

Can't enable JavaScript MLE on APEX

I am running Oracle APEX 21.1 (build 21.1.3.r1531102) on the 21c express database and for some reason I cannot execute server side code with the JavaScript MLE option.
In the develpment environment it does not show the option at all.
In the SQL commands screen I can only execute pure sql or PL/SQL. If I try to execute the following example
SET SERVEROUTPUT ON;
DECLARE
ctx dbms_mle.context_handle_t;
user_code clob := q'~
console.log('Hello World!');
~';
BEGIN
ctx := dbms_mle.create_context();
dbms_mle.eval(ctx, 'JAVASCRIPT', user_code);
dbms_mle.drop_context(ctx);
EXCEPTION
WHEN others THEN
dbms_mle.drop_context(ctx);
RAISE;
END;
I get the following message:
ORA-00922: missing or invalid option
ORA-06512: at "SYS.WWV_DBMS_SQL_APEX_210100", line 673
ORA-06512: at "SYS.DBMS_SYS_SQL", line 1703
ORA-06512: at "SYS.WWV_DBMS_SQL_APEX_210100", line 659
ORA-06512: at "APEX_210100.WWV_FLOW_DYNAMIC_EXEC", line 1854
A few weeks ago we solved this and I forgot to update this question.
After some work we found out that user needed to be granted access to MLE. I was not that one who fixed, but I've asked the code to post here, check below:
GRANT MLE JAVA
GRANT EXECUTE DYNAMIC MLE to XYZ;
GRANT EXECUTE ON JAVASCRIPT TO XYZ;
Remove the first line or comment this out, I suppose this is for on premise DB version support but not allowed in ADB.

How can I run functions of dbms_output as non-admin?

I have XE on my computer, using Oracle Database 18c. Earlier, I was able to execute function dbms_output.put_line(); even I logged in as sysadmin or with default role. Now, I only can run dbms_output.put_line() when I am logged in as sysadmin/sysdba. As a default user, I get the following message:
PLS-00201: identifier ‘DBMS_OUPUT.PUT_LINE’ must be declared
I tried to add privilege to execute dbms_output with command
grant execute on DBMS_OUTPUT to username;, however, I got this message when I execute a command including dbms_output.put_line():
ORA-04067: not executed, package body "PERFSTAT.DBMS_OUTPUT" does not exist
ORA-06508: PL/SQL: could not find program unit being called: "PERFSTAT.DBMS_OUTPUT"
Using sqlplus, I get the following error as default user:
PLS-00201: identifier 'DBMS_OUTPUT.ENABLE' must be declared
How can I solve this problem?
That's probably because you misnamed it:
No : DBMS_OUPUT.PUT_LINE (not "ouput" but "output")
Yes: DBMS_OUTPUT.PUT_LINE
As of the 2nd message; well, this: PERFSTAT.DBMS_OUTPUT doesn't make sense, PERFSTAT doesn't own that package. It is called just as
begin
dbms_output.put_line('Hello');
end;
/
and works for any user, no special grants required.

Attempting to install utPLSQL 3.1.10

I have downloaded utPLSQL.zip from github, unzipped the archive, opened the user guide bundled with the zip, and have started following along with the manual installation process.
I'm using Oracle 18c XE, SQL Developer 20.2, and utPLSQL 3.1.10.
I'm using sqlplus to execute scripts, logging in using the command: sqlplus '/ as sysdba'
The first three scripts run fine:
#create_utplsql_owner.sql <schema name> <password> users;
#install.sql <schema name>;
#install_ddl_trigger.sql <schema name>
The fourth script:
#create_synonyms_and_grants_for_public.sql <schema name>;
Fails with the exception:
Creating synonyms for UTPLSQL objects in schema to user PUBLIC
create public synonym ut for .ut
*
ERROR at line 1:
ORA-00955: name is already used by an existing object
Has anyone run into this?
I tried reverting to utPLSQL 3.1.9 but ran into the same issue...
Thanks!
My first installation attempt of utPLSQL had failed.
I deleted the schema which was intended to act as the test repository,
and that is when this particular problem started.
Digging into utPLSQL installation scripts and some Oracle documentation I found that deleting a schema does not remove said schema's public synonyms from the table DBA_SYNONYMS.
Running the install script: install.sql
creates several synonyms where is the owner.
Running the install script: create_synonyms_and_grants_for_public.sql
creates a load of public synonyms.
Dropping the schema to reset and resinstall utPLSQL only deletes the synonyms where is the owner -- the public synonyms have to be manually deleted.
This script does the job and allows a clean installation to take place:
declare
sqq varchar2(250);
v_code varchar2(250);
v_errm varchar2(250);
cursor del_syns is
SELECT synonym_name
FROM DBA_SYNONYMS
WHERE table_owner = 'C##UNIT_TEST_REPOSITORY';
begin
FOR syn_name IN del_syns
LOOP
sqq := 'drop public synonym ' || syn_name.synonym_name || ' force';
dbms_output.put_line(sqq);
execute immediate sqq;
END LOOP;
EXCEPTION
when others then
v_code := SQLCODE;
v_errm := SUBSTR(SQLERRM, 1, 64);
DBMS_OUTPUT.PUT_LINE ('------- Error code ' || v_code || ': ' || v_errm);
end;
Please follow these instructions for installing utPLSQL 3.1.10 on your system.
After unzipping folder, go to folder called SOURCE and open create_utplsql_owner.sql in SQL Developer(You can simply drag that file to already opened SQL Developer Worksheet and user schema SYSDBA). You can press F5 and script will execute following code and ask you to insert name of new schema owner of utPLSQL, it is default to type ut3, second input is password (ut3) and third is for tablespace: default is user.
Go to install.sql file, drag to SQL Developer and just press F5
create_synonyms_and_grants_for_public.sql this script will allow you to share framework along to the other users,
if you want to run utPLSQL on another user schema you can use create_user_grants.sql and create_user_synonyms (first parameter is owner UT3, second is user which can execute framework functionality like UT3 user).
After installing framework, connect to UT3 schema and write this code to check if framework is successfully installed.
-- Test
exec ut.run();
if you see something like procedure is successfully completed, and you can not see real output, that problem is solved by setting set serveroutput on;
I hope that my explanation is helpful, please write feedback or ask if you have any misconceptions :)

ORA-01460 with mod_owa and OwaDocTable

I'm playing with Doug McMahon's Apache PL/SQL Gateway Module (https://oss.oracle.com/projects/mod_owa/dist/documentation/modowa.htm) in a test environment. I'm getting the error below while trying to upload a binary file using the OwaDocTable option. Same code works with mod_plsql.
SQL ERROR
Error 1460 calling procedure:
ORA-01460: unimplemented or unreasonable conversion requested
The last SQL statement executed was:
begin insert into ATEC2_SCHEMA.UPLOADS (NAME, MIME_TYPE, DOC_SIZE, DAD_CHARSET, LAST_UPDATED, CONTENT_TYPE, BLOB_CONTENT) values (:B1, :B2, :B3, :B4, SYSDATE, 'BLOB', empty_blob()) returning BLOB_CONTENT into :B5; end;
I forgot to specify that my test environment was an old 32 bit linux system with Apache 2.0. I try to replicate the problem in a more modern 64 bit linux system with Apache 2.2 and the app works there. So problem solved.

Error report - No more data to read from socket

While executing a procedure in a package,
BEGIN
SYS_test.test_job.start(25698);
END;
I'm receiving below error:
Error starting at line : 1 in command -
BEGIN
SYS_test.test_job.start(25698);
END;
Error report -
No more data to read from socket
I've searched on internet but I'm unable to solve this issue.
Could you please help why I'm receiving this error?

Resources