Import the query written in notepad to SQL plus - sqlplus

how to import query written in notepad to SQL plus ??
I tried to open notepad file in SQL plus as #file_name.sql . But it didn't work.

Related

Select query With Order Localized Caharacters

I use Sqlite on Android with Android Studio.
Select * From MyTable ORDER BY MyStringField COLLATE LOCALIZED
returns correct order with local characters.
On ios i use Xcode 13 and swift.sqlite
But there is no LOCALIZED option on queries.
There is Binary option which is not working.
Returns strings which are starting with local characters returns at the end.
How do i perform language specific collation on sqlite.swift on ios
Regards

DB2 simple Select SP

i try to get an SP to run on DB2 connected with Squirrel
CREATE OR REPLACE PROCEDURE BOCA.TESTSP
(IN CASID INTEGER)
READS SQL DATA
DETERMINISTIC
LANGUAGE SQL
BEGIN
SELECT * FROM BOCA.TCASE C WHERE C.ID = CASID
END;
I get various errors based on where I put the ; (at end of statement etc)
i tried to follow this approach:
CREATE PROCEDURE [qualifier.]<procedure_name>
([IN | OUT | INOUT <argument_name> <datatype>,...])
{MODIFIES SQL DATA |
NO SQL |
CONTAINS SQL |
READS SQL DATA}
[[NOT] DETERMINISTIC]
LANGUAGE SQL
BEGIN [ATOMIC]
<procedure_body>
END
But did not succeed.
Anyone have a simple select that runs?
Stange is that an sample update I was able to create
Take some time to study the sample code that IBM supplies for SQL PL procedures, get these samples built and working in your environment. The samples are in the documentation, also they are on github, also they are in the SAMPLES directory of your Db2-server installation (for DB2 on Linux/Unix/Windows).
Your procedure has some mistakes:
missing statement separator after the SELECT statement
incorrect usage of SELECT in a routine. You either want to declare and open a cursor to return a result set to the caller or client, or you want to use SELECT...INTO to process the result of the query inside your routine.
missing valid separator at the end of the block of code (after the final END)
For SQuirrel SQL Client, before you connect to the database:
File > New Session Properties > SQL
(scroll down the list of properties until you see:
Statement Separator ;
Change the Statement Separator to #
Click OK.
Now connect to the database.
When you then type any SQL statement inside Squirrel (or a block, such as a trigger, stored-procedure, user defined function etc), you must now use the new statement separator instead of the previous default value at the end of the whole statement.
Inside of your routines , you will still need to use the semicolon to delimit statements inside the block, but remember to specify the new statement separator at the end of the block (after the final END in the stored procedure in your case).

SOLR 5.1 Join query parser with phrases

I have a set of files in the file system, and in the database i have several information about each of those files and other files that dose not exist in the file system , the data is indexed from both the DB and the file system, the search requireent is as follows; if the query is found in the DESC field (taken from the DB), then the document must be returned, and if found in the content of the file, then the document from the DB related to this file must be returned ( i can join the related documents based on the path of the file), i have two problems, i could not implement the required in a single queryand i found that the join query parser dose not work with phrase, can you help me:
the query:
/select?fl=&wt=json&q={!join from=resourcename_s to=FULL_FILE_PATH}test
return only the DB info about the file where "test" is found, but i have another record in the DB that has "test" as its DESC and must be returned, i tried
/select?fl=&wt=json&q={!join from=resourcename_s to=FULL_FILE_PATH}test OR test
b ut it did not work, i also found that the join query parser dose not work with phrases?

How can I use call a stored procedure within SAS without using ProcSQL?

At my Co-Op my manager is asking me to take my SAS output tables that I've gathered and then to execute a stored procedure that will upload and update any data that has changed into an online KPI(Key Performance Indicators) excel sheet.
Apparently my boss isn't too sure of how to do this even and he's been programming for quite some time.
In laymen's terms this is what I need to do:
create a table of gathered KPI's (Done)
Send the table to the Stored Procedure (I don't want to use ProcSQL in SAS 9.3 because I would be hardcoding in too many fields)
Have the Stored procedure read into the online datasheet (done)
Replace KPI's if they have changed (done)
Here is the ProcSQL that I have figured: Ambiguous names have been given to keep anominity:
%let id = 'HorseRaddish';
%let pwd = 'ABC321';
proc sql;
connect to odbc (dsn='JerrySeinfeld' uid=&id pwd=&pwd);
execute (spKPIInsertUpdateKPIData '411', '7.2', '8808', 'M', 'NANANA', 'WorkStation', 'Testing1212', '1', '8/3/2013 10:42AM') by odbc;
disconnect from odbc;
quit;
run;
Above code works fine, but like I said it's a pain to hard code in KPI calues for hundreds of fields.
If it were me, and I had flexibility to do so, I would rewrite the SP to pull the parameters from a table and upload the table, then call the SP. That's got to be faster.
If it's not, you can script that SP line fairly easily. You will still run it in PROC SQL, but you don't have to write it out by hand.
Something like:
proc sql;
select cats("execute(spKPIInsertUdateKPIData '",var1,"''",var2,"','",var3,<... more ...>,"') by odbc") into :execlist separated by ';';
quit;
That creates a macro variable &execlist that contains the calls to the SP. Then you just do
proc sql;
connect to odbc ... ;
&execlist.
disconnect from odbc;
quit;
That does have some length limits, you might have to do it a bit differently (either cut it up or use %include) if you are over ~20k characters.
But again, this is probably not a very good way to do this - better is load to table and have the SP update from that table. Something like:
libname sqldb oledb init_string=whatever;
proc sql;
drop table sqldb._tempSP_KPI;
create table sqldb._tempSP_KPI as select * from <dataset containing values>;
connect to oledb (init_string=whatever);
<exec SP that uses the _tempSP_KPI table)>
quit;
quit;

Search on unicode strings using ADOQuery on NVarchar2 fields in ORACLE fails

If ADOQuery is used to connect to ORACLE database using Oracle OLEDB provider search on unicode strings for NVARCHAR2 fields fails
In the Oracle (11g) database, there is a table like
create table unicodetest
(Code Number, Name NVarchar2(100))
Now I have inserted data into it
(done through sql developer)
insert into unicodetest
values (1, N'ユニコード')
Now from delphi (XE2) application, I used TADOQuery to connect to ORACLE database using ORAOLEDB provider.
Now if I search for unicode string using following query
select * from unicodetest
where
NAME like N'%ユニコード%'
It returns 0 records
tried with out using N but same result

Resources