Home Download Buy Blog Forum Support

Oracle PL/SQL

Oracle PL/SQL

Postby bizoo on Thu Jan 26, 2012 1:26 pm

Someone ask me how I work with PL/SQL, here it is...
It was created only for my own usage and tailored for it, so don't ask too much...

Notes:
-It was only tested on Windows, so it will probably not work out of the box on other OS. But it could probably work.
-The syntax def. come from somewhere on internet and was slightly updated by myself.
-I work with scripts (.sql) that contains more than one 'create or replace' instance.
-It hijack the Build system to modify the output of it. This way standard error navigation (f4/shift+f4) should work.
-It use sqlplus.exe from Oracle (must be on path).
-The menu of Build come from Sublime Text 2\Packages\OracleSQL\oracle_functions.py and have to be updated for your need (a settings will be better, maybe next time ?):
Code: Select all
class OracleExecuteListCommand(sublime_plugin.WindowCommand):
    instance_list = [["MASTER COMPANY", "DEVELOP/DEVELOP@DEV1252A"], ["MASTER PCS", "PCS/PCS@DEV1252A"],
                    ["10.02 COMPANY", "DEMO_MAS_F/DEMO_MAS_F@T1002U"], ["10.01 COMPANY", "MAS_F/MAS_F@T4001U"]]


Good luck.
Attachments
SublimeOracleSQL.zip
(12.43 KiB) Downloaded 1525 times
bizoo
 
Posts: 873
Joined: Wed Dec 08, 2010 6:53 am
Location: Switzerland

Re: Oracle PL/SQL

Postby hackvan on Mon Jun 25, 2012 1:48 am

Hi, I'm trying this script with Sublime Text 2 on Ubuntu 12.04 and it's great!!!
thanks a lot.
hackvan
 
Posts: 1
Joined: Mon Jun 25, 2012 1:46 am
Location: Latin America

Re: Oracle PL/SQL

Postby bizoo on Mon Jun 25, 2012 7:52 pm

I am surprised that it works 'out of the box', the binary for sqlplus is called "sqlplus.exe" on Linux too ?
I think I changed a few things in the past months. If I have some times, I will push everything on github.
bizoo
 
Posts: 873
Joined: Wed Dec 08, 2010 6:53 am
Location: Switzerland

Re: Oracle PL/SQL

Postby dudymas on Sat Aug 25, 2012 4:12 pm

Hey, is there a github or bitbucket for this yet?

I'm just mucking around on github and can't find anything there.

If it stays like that, I want to start sharing any changes I make. Would that be okay? I'll just have to link the repo back to this forum post, which is suboptimal.
dudymas
 
Posts: 1
Joined: Sat Aug 25, 2012 4:00 pm

Re: Oracle PL/SQL

Postby bizoo on Mon Aug 27, 2012 6:47 am

dudymas wrote:Hey, is there a github or bitbucket for this yet?

https://github.com/bizoo/Oracle

Feel free to change whatever you want and send Pull request, or Fork it.

As I already wrote in this topic, I only tested it on Windows.
bizoo
 
Posts: 873
Joined: Wed Dec 08, 2010 6:53 am
Location: Switzerland

Re: Oracle PL/SQL

Postby jl3 on Fri Jan 24, 2014 4:27 am

Hi,

When I'm using this, sometimes when i build, if it doesn't compile or has warnings it does not give me the error messages and it doesn't update the database. Instead, it just goes [Finished in 0.2s].

On good times, it will give me the error and the line it is on and f4 error navigation works.

When running PL/SQL anonymous blocks that doesn't have an error it'll return my query results and display.

Filename: C:\temp\test2.sql
AND TYPE || ' ' || NAME in ()
*
ERROR at line 4:
ORA-00936: missing expression


[Finished in 0.3s]

Are these known issues and is there a fix for them?
jl3
 
Posts: 1
Joined: Fri Jan 24, 2014 4:23 am

Re: Oracle PL/SQL

Postby jbjornson on Fri Jan 24, 2014 10:14 am

This has been bugging me for a while as well so finally I took a look into the code. It happens when there isn't a create or replace statement in the file. I was able to fix the problem by changing the following code in oracle_exec.py:

Before:
Code: Select all
            sqlfilter = '"' + ",".join("'%s'" % entity for entity in self.entities.keys()) + '"'


After:
Code: Select all
            if len(self.entities) == 0:
                sqlfilter = "\"''\""
            else:
                sqlfilter = '"' + ",".join("'%s'" % entity for entity in self.entities.keys()) + '"'


I'll make a pull request with the change on github...
jbjornson
 
Posts: 340
Joined: Tue Oct 27, 2009 4:25 pm
Location: Zurich, Switzerland

Re: Oracle PL/SQL

Postby makebei on Thu Jan 30, 2014 5:59 am

Does anyone have this running with SublimeText 3? I used to have it running with SublimeText 2, but I can't get it to work with SublimeText 3. In the console I get the error message:

Unable to find target command: oracle_exec
makebei
 
Posts: 1
Joined: Wed Feb 15, 2012 2:30 am

Re: Oracle PL/SQL

Postby jbjornson on Thu Jan 30, 2014 9:14 am

makebei wrote:Does anyone have this running with SublimeText 3? I used to have it running with SublimeText 2, but I can't get it to work with SublimeText 3. In the console I get the error message:

Unable to find target command: oracle_exec


I got this code from bizoo a while ago but he hasn't updated the package with it (maybe he's still using ST2). This gist linked to below also has some fixes for handling spaces in paths and preventing an error from being shown when executing a file that doesn't have any DML in it.

https://gist.github.com/jbjornson/8704419

I'd happy to create a patch to bizoo with a version that works on both ST2 and ST3 but I'm not sure how to handle the different import between the two versions:

On ST2:
Code: Select all
execmod = __import__("exec")


On ST3:
Code: Select all
from Default import exec as execmod


Anyone know how to handle both those import cases?
jbjornson
 
Posts: 340
Joined: Tue Oct 27, 2009 4:25 pm
Location: Zurich, Switzerland

Re: Oracle PL/SQL

Postby jbjornson on Thu Jan 30, 2014 9:22 am

You'll also need to update oracle_commands.py as well for ST3 compatibility.

oracle_exec.py
https://gist.github.com/jbjornson/8704419

oracle_commands.py
https://gist.github.com/jbjornson/8704545
jbjornson
 
Posts: 340
Joined: Tue Oct 27, 2009 4:25 pm
Location: Zurich, Switzerland

Next

Return to Plugin Development

Who is online

Users browsing this forum: Exabot [Bot] and 5 guests