Compile PL/SQL stored procedures in SQL developer from external files - plsql

I have a requirement where I have around 50 stored procedures saved in 50 different files with .pls extension in a windows directory. I have SQL Developer installed in the same machine. I want to compile all these stored procedures in SQL developer. Note - I don't want to execute, only want to compile. Please suggest a solution for this.
I have tried this but it didn't work.
Created a compile.sql file with contents below.
##"U:\Stored_Procedures\PRC_LOAD_TBL.pls";
exit;
Created a compile.bat file with contents below.
sqlplus -s -l <username>/<pswd>#<servicename>
#"U:\Stored_Procedures\Compile.sql" ;
Tried to run compile.bat batch file but it didn't work.
Also, I tried to run these from SQL Developer directly that didn't work either.

"Tried to run compile.bat batch file but it didn't work."
You tried to run a DOS batch file in SQL Developer? I think you're over-engineering this.
All you need to do is open your first script, compile.sql in SQL Developer and then click Run script (or press F5 function key).

Related

How do I run SQL commands through Notepad++?

I am trying to start out using Notepad++ to run SQLite commands. I have tried following two brief YouTube tutorials to get me going. I can run the initial .bat file, but still cannot run the .sql file.
I have a Windows system environment Path variable set to the folder containing sqlite3.exe
"C:\Users\Adam\sqlite\"
I have saved the following file RunSQLite.bat in the folder containing sqlite3.exe
sqlite3.exe testDB.db
I have created a second file queries.sql
SELECT 34;
When I try to run queries.sql from Notepad++, using the RUN command:
C:\Users\Adam\sqlite\RunSQLite.bat "$(FULL_CURRENT_PATH)"
the only file that appears to run is RunSQLite.bat, giving the output:
SQLite version 3.36.0 2021-06-18 18:36:39
Enter ".help" for usage hints.
sqlite>
Can anyone tell where I have gone wrong?
Thanks in advance.
aphopk
This C:\Users\Adam\sqlite\RunSQLite.bat "$(FULL_CURRENT_PATH)" will do exactly the same thing if run at the shell. RunSQLite.bat does not take any arguments so the Run command in npp is working as expected.
sqlite3 takes input from an external file with the .read command.
Path issues notwithstanding a bat file something like this should accomplish the task:
sqlite3.exe testDB.db ".read %1"
Notepad++ is a text editor, so you can now use it to edit your SQL file. After selecting the Language > SQL, Notepad++ will highlight SQL syntax as you type. Try typing some SQL, like
SELECT "Hi";
SELECT * FROM mydatabase WHERE id LIKE 'ID%';
You will see color, bold, and other possible formatting applied to the text you type. If you save the file as something.sql, and then load something.sql in your SQL client, the client will run the SQL commands from that file. If you have an existing somethingElse.sql file, you can open it in Notepad++, which will auto-recognize that it’s SQL and apply the syntax highlighting, allowing you to edit it and save it.
By using the Run > Run dialog, you can run an arbitrary command. For example, if your SQL client has a command-line mode accessed thru sqlclient.exe, you could type
c:\path\to\sqlclient.exe $(FILE_NAME)
If you just run it, that probably won’t show you any results… but if you ran
cmd /k c:\path\to\sqlclient.exe $(FILE_NAME)
It will open a new cmd.exe Windows command prompt, and show the output from that file.
If instead of running, you hit “SAVE”, you can give it a name (which will end up later in the Run menu), and/or a keyboard shortcut, so that you can easily re-use that many times.
If you want to do something more fancy, use the NppExec plugin, which includes a better batch/scripting language. Once again, you can save the NppExec script, and make it show up in the Macro menu.
If Python is a programming language you know or could learn (or if, like me, you know enough other programming languages that you can fake the Python), then the Python Script plugin will allow you to do even fancier stuff. (Python is a complete programming language, and has many libraries written, which could act as an interface between your SQL source file and your database engine; PythonScript has access to a full python2.7 interpreter. For example, you could write a script in Python which executes the commands from your SQL, grabs the results from your database engine, and displays them in Notepad++, either inline with your original SQL code, or in a new text document. You are really limited only by your imagination and knowledge of Python.)

Copying a file to sharepoint through SAS unix

As a part of my work I need to create few reports in SAS and export them to sharepoint site. I am trying to automate this process as shown below.
call system ("cp -p file.xls https//sharepointsite/folder1/file.xls");
when i run this code, it is not giving any error in the code but the file not uploaded into sharepoint.
Could anyone suggest me the solution for this case.
Try the following in order to extract any errors into your log
data _null_;
infile "cp -p file.xls https//sharepointsite/folder1/file.xls" pipe;
input;
list;
run;
You can also try running the command directly from your SAS server, as a shell command. If that is successful, the above should be succesful (although I wasn't aware that uploading files to sharepoint was that straightforward).
Edit: from reading around, I think it IS possible, you just need to have your sharepoint location mapped to a local directory, and to have contributor rights on the site itself. In which case make sure you use the 'local' path for the URL..

Unable to create query COPY PostgreSQL PQSQL driver

Well the thing is that when the program execute the query to copy a table to a file .CSV. Qt show me the next error.
"ERROR: syntax error at end of input
LINE 1: EXECUTE
Here are the code of the export action:
QSqlQuery qry;
qry.prepare("copy inventory to './inventory.csv'");
if(qry.exec()){
qDebug()<<"Succes";
}else{
qDebug()<<qry.lastError().text();
}
The version of qt is 5.4, used postgresql 9.3 and driver PQSQL working fine just can execute another's query very well like select.
Thanks.
You mentioned that you're using Qt's SQL interface and its PostgreSQL driver.
While Qt's PostgreSQL driver is built on top of PostgreSQL's standard client library libpq, as far as I can tell it does not offer support for lots of the functionality of libpq. In particular, there appears to be no way to access support for the COPY protocol, nor for LISTENing for asynchronous notifications.
You will have to:
libpq directly to COPY ... FROM STDIN
or use regular INSERT statements via Qt; or
Transfer the CSV input to the server, then use COPY ... FROM '/path/on/server' to read the input from a file on the server that the PostgreSQL database is running on, readable by the user the PostgreSQL database runs as.
(You could also submit a patch to Qt to add support for the COPY protocol, which shouldn't be too hard to implement, but is perhaps not the best choice if you're asking this.)
Using COPY needs superuser rights . Do not confuse with \COPY of
PostgreSQL
COPY TO requires absolute path to the output file. If 1st point is
considered, try removing the ./ in your output file name
You can refer to related posts:
post1
and
post2

Script runs in Unix but not in Informatica command task

My script ran successfully in Unix but not in a command task of an Informatica workflow. The permissions are fine, and the parameter file and variables have been declared in the workflow. Why is this happening?
Make sure that the machine you are running informatica on, is running in a unix box.
If it is on a windows machine, you will have to run the DOS equivalent command for your script.
Check whether informatica repository is pointing to same UNIX server, in which the script to executed from informatica is present.
I to faced same situation ,please check the propertied of script file make it as 755(CHMOD),It should work.
Regards
Rama
This could be a permission issue. If you are executing a shell command from Informatica, right click the file in SFTP and click on "Properties" (I am using Winscp).Give full permission to the file and now it should work.

Script to recursively look for a file on ftp server until it found

I just want to transfer a file from ftp server to unix folder, --this is stright forward.
if the file doesn't exist on the ftp server, then the script needs to run recursively until it finds the file. Please let me know how do i get that file.
please remember script has to run on ftp server.
Thanks
CK
I'd mount the FTP server with curlftpfs http://curlftpfs.sourceforge.net and then use it like it were a local file system — for example, run find(1).
You need to write a program to automate your FTP session. You can either write your own custom FTP client, not that hard if you know a few things about network programming, or write a script to automate a session for an existing client. For the latter approach, I suggest using Expect if you are proficient with TCL, or PyExpect if you prefer Python. Expect is a library designed to automate interactive tasks like downloading a file with FTP.

Resources