How to distinguish the SQL capabilities of PL/SQL?
I m having trouble understanding what functions is used ONLY in SQL and are used in regular expr instructions (IE, variable assignment,). Can someone show me a list of each or maybe a URL to look for?I have searched through the guide and reference is the developer, but could not find an indication appropriate in a place that it is clear.
For example, I thought that I can use the CAST function in a variable assginment as follows:
declare
cursor myCur is SELECT Value_varchar2(1) FROM table WHERE id = 1;
myRec myCur%ROWTYPE;
var_a NUMBER(1);
begin
OPEN myCur;
FETCH myCur INTO myRec;
CLOSE myCur;
var_a := CAST(myCur.Value_varchar2(1) AS NUMBER(1));
DBMS_OUTPUT.PUT_LINE('var_a = ' || TO_CHAR(var_a));
end;
.
It seems that CAST function can ONLY be used in an SQL statement, but no doc has so far only?Edited by: HappyJay 05/12/2010 12:05
In PL/SQL, drop the length specifier when you cast:
SQL> exec dbms_output.put_line(cast('123' as number(5)));
BEGIN dbms_output.put_line(cast('123' as number(5))); END;
*
ERROR at line 1:
ORA-06550: line 1, column 48:
(blah blah blah)
SQL> exec dbms_output.put_line(cast('123' as number));
123
PL/SQL procedure successfully completed.
Tags: Database
Similar Questions
-
Hi Expert,
How to distinguish the physical interface and logic (subinterface) interface to the Cisco router/Switch? Can you please clarify a formal way for this so have?
A physical interface is numbered with the same name of the interface when printing on the physical port. For example "GigabitEthernet 0/1" corresponds to port 1 of the 0 module (or the base unit).
A logical interface can be a subinterface on a routed port and will have a point ("". "") preceding the number sous-interface (ex. GigabitEthernet 0/1.1). It can also be a loop or a virtual interface (on a router this could also include interfaces like the tunnel and virtual tunnel or VTI types). A switch may also have a VLAN logical interfaces (e.g. interface vlan 1) which are used as layer 3 virtual interfaces of type.
-
How to import the .sql file in oracle apex?
I am new to oracle apex...
How to import the .sql file in oracle apex?
I have to import a table in apex...
This script I have to write in the .sql file...
pls help...
Published by: 794244 on January 31, 2011 21:31Hi Manu
You can import and browse workshop SQL, SQL Scripts .sql files. If you have multiple SQL statements in your script, make sure that they are separated by the / character
Andy
-
How to get the SQL if I get exception
I get this exception and do not know what was the actual sql with the variables of liaison who was executed.
sqlmesg = error in the select query to retrieve the segment associated with a pair of cables: ORA-01006: there is no bind variable
y at - it a way to get the real sql executed so I know what mistake I did.I thought your question was about how to view the SQL statement and bind variables in the exception. The answer to that is to put variables in the exception message.
The root cause of the problem seems to be that your dynamic SQL statement may require 3 or4 variable bind but your USING clause specifies always 4 values if the underlying SQL statement has 3 positions, it will lead to an error.
Justin
-
How to get the sql query result?
Hello
Currently I use LV2012 to connect to an Oracle database server. After the Oracle Express and Oracle ODBC driver facilities/settings made.
I managed to use the SQL command to query the data through my command prompt window.
Now the problem is, how to do the same task in Labview using database connectivity tools?
I have build a VI to query as being attached, but I have no idea of what range to use to get the result of the query.
Please help me ~ ~
Here is a piece of code that I use to test the SQL commands, you can use the part that retrieves the results of sql.
It is also possible to get the rear column headers, but it's for the next lesson!
;-)
-
How to distinguish the figures and characters from a string
I am looking for a simple way to do this or any built-in subVIs that can do this.
I have 3 strings "1234c", "ab3dc". 'XYA', I want to identify those who have numbers and to reclaim all of the numbers. So an important step is to distinguish the character numeric and non-numeric characters. How can I do it in Labview with subVIs integrated?
Thank you
[0-9] is looking for a number, "+" makes the search for 1 or more of them (it is "greedy", so it will get as many as there are has). I added a rope in addition to your list to show that the Pattern Match will match only the first instance of a number. If there's a chance you have data as the last element that you need to run it in a loop. Decimal string number can also work if a figure is the first character that it finds.
-
How to distinguish the events within an EventHandler?
Hi all,
being a newbe in JavaFX I try to distinguish the different eventtypes.
I try to produce a MouseEventHandler accepting soe as MOUSE_DRAGGED and MOUSE_PRESSED events
for the calculation of how mouse took and use it to translate my graphics nodes.
I still don't really understand what is the correct syntax.
something like
If (event.getEventType instanceof MouseEvent.MOUSE_PRESSED ())
{
...
}
obviously does not work.
something like
switch (event... getEventType())
{
case MOUSE_PRESSED:
...
}
also isn't the right way.
Is it possible to tell them apart?
Thank you very much in advance
Malta
if (event.getEventType() == MouseEvent.MOUSE_PRESSED) { // ... }
should work.
I've never done this, fwiw. I always just save different implementations of listener for different event types:
node.addEventHandler(MouseEvent.MOUSE_PRESSED, new EventHandler
() { @Override public void handle(MouseEvent event) { // handle mouse pressed } }); node.addEventHandler(MouseEvent.MOUSE_RELEASED, new EventHandler () { @Override public void handle(MouseEvent event) { // handle mouse released } }); In Java 8 this will get much less verbose (using lambda expressions).
-
How to execute the sql statement in the file beats?
I want to execute after the statement
C:\ > sqlplus/nolog
SQL > conn scott/tiger
SQL > select * from tab;
I know I can achieve it following test.bat and testdb.sql file
test.bat is:
sqlplus/nolog @testdb.sql
TestDB.SQL is:
Conn scott/tiger
Select * from tab;
Now I don't want to use the sql file, I want only use bat file, as follows:
test.bat is:
sqlplus/nolog
Conn scott/tiger
Select * from tab;
When I run test.bat, I find only one sqlplus /nolog execute statement, do not execute other statements.
(1) I want to know if there is a method to run the SQL file by fighting without a sql file? How to make it happen?
(2) if I call the sql file, how to hide the password of user? Because I don't want other people to know scott password, if I use conn scott/tiger in testdb.sql, other person can see testdb.sql and the password. Is there a good way to avoid?
Thank you!It works a bit different in Windows. Create a file is like this:
( echo conn scott/tiger@orcl echo spool c:\temp\list.txt echo select sysdate from dual; echo spool off echo exit ) | sqlplus -s -l /nolog
-
How to write the sql command in the batch file
Jin
I m using oracle 9i on windows. I want to know how I can write the sql on the command file command. I want to use a batch file to use the sql like shutdowm command & start command and any select command too.
so please tell how can I do?
thxsTried looking for what he superdba.
Can't connect to sqlplus using sys using a batch file
HTH
Aman... -
How to see the sql on the tables verified statements?
Hi all
I just check schema as the following comment run
AUDIT UPDATE TABLE DELETE TABLE INSERT TABLE BY user1, user2 BY ACCESS;
However, I could not find the SQL statements.
SELECT A.TIMESTAMP, A.* DE DBA_AUDIT_TRAIL A
OÙ
Username = ' USER1'
Also, this does not work, it shows empty
select sql_text from sys. aud$ où obj$ nom = « TAB_PROJELOG »
Oracle Database 11 g Release 11.2.0.4.0 - 64 bit Production
db
Redirect audit records to the database audit trail (the
SYS.AUD$
table), except for records that are always written in the track operating system audit. Use this setting for a general database for administration.If the database is started in read-only mode with
AUDIT_TRAIL
defined ondb
, then affects the Oracle database internallyAUDIT_TRAIL
toos
. Check the log of alerts for details.db, extended
Performs all the actions of
AUDIT_TRAIL
=db
and fulfills also the bind SQL and SQL CLOB type text columns of theSYS.AUD$
table, when it is available. These two columns are filled only when specified.If the database is started in read-only mode with
AUDIT_TRAIL
defined ondb, extended
, then affects the Oracle database internallyAUDIT_TRAIL
toos
. Check the log of alerts for details.
https://docs.Oracle.com/CD/E11882_01/server.112/e40402/initparams017.htm#REFRN10006
-
How to find the sql queries executed in one day with the sql and runtime text
Hi Experts,
Please tell me the sql query to find out the queries executed on a particular day and the runtime and the sql text of the query.
Please reply urgent.
Thanks in advance
Database instance 'A' may have run 100 SQL queries today. As for the instance of database 'B' could have exploited queries SQL 1 million today. Instance of database 'B' to 'keep' the 1 million SQL statements - in memory or on disk do you expect? Of course not. There the age or flush or invalidate memory SQL statements. He can't keep them on the disk (imagine running a completely different set of 1.2million SQL statements tomorrow and 1.3 the next day).
AWR and StatsPack can make counts the number of "n" top of the page ("n" default to 30) SQL statements which are still present in the cache of the library (not years, rinsed, invalidated) when a snapshot was taken. They can't declare "all" SQL statements.
To return to your needs. WHY do you need all the SQL statements? Or are there only certain operations specific SQL would you be interested? Could they have been treated by allowing audit (for example, UPDATE and DELETE with EXTENDED verification instructions)?
Hemant K Collette
-
How to extract the sql text with SID and SERIAL No.
Hello
I am new to oracle database and recently I started my journey in the optimization of the performance.
I need to retrieve the sql text that is triggered by the user in function were SID and SERIAL No.
Thanks in advance...
PrabhaSelect
a.SID,
a.Serial #.
b.sql_text
Of
session v$ a.
v$ sqlarea b
where
a.sql_address = b.Address
and
SID = 43; -
How to format the sql format GET easily in sqlplus
Hello
I use TOAD to format my sql always (to help shift + ctrl + F). It's really frustrating because I have to format the sqls a lot all the time. I have recently joined a successful dba team and need to quickly understand the sqls.
A member of the forum can you please suggest me a way to do it quickly in sqlplus itself?
Thanks & take care,.
MalikaAnthony wrote:
But there are situations where I have to work on machines where I can't access the internet because of procedures/etc security problems, that's why I need to find a way to quickly put the sqls in sqlplus/unix itself.
SQL * Plus is not an editor does not support formatting of unformatted existing SQL code. It uses an external editor - and formatting you want to, must be a function or feature of the external editor. The Unix/Linux default editor is vi or vim. Emacs, kate and others can also be configured (using the EDITOR environment variable) for use with SQL * more.
Formatting manual is often a 'good' thing that it forces you to slow down and look at each line (when the manual formatting) in the code. So they identify issues and problems that could be missed when looking at already formatted code.
-
How to distinguish the form as textfield element
I use the following script to disable all elements on the page:
for (var nPageCount = 0; nPageCount < xfa.host.numPages; nPageCount ++) {}
var oFields = xfa.layout.pageContent (nPageCount, "field");
var nNodesLength = oFields.length;
Set the field property.
for (var nNodeCount = 0; nNodeCount < nNodesLength; nNodeCount ++) {}
If (oFields.item (nNodeCount) .access! = "readOnly")
{
oFields.item (nNodeCount) .access = "readOnly";
}
}I have a requirement where I have to disable only the textfields. So, can someone please help me with how to get the field of a particular field type.
Thank you.
Paul approach is good. But it requires the developer to follow a specific naming standard.
Here is my code that makes the TextFields readOnly fields regardless of the name of the field.
for (var nPageCount = 0; nPageCount < xfa.host.numPages; nPageCount++) { var oFields = xfa.layout.pageContent(nPageCount, "field"); var nNodesLength = oFields.length; for (var nNodeCount = 0; nNodeCount < nNodesLength; nNodeCount++) { var ref = oFields.item(nNodeCount).getElement("ui"); if(ref.nodes.item(0).className=="textEdit") // If the field is a TextBox, then proceed { if(oFields.item(nNodeCount).access != "readOnly") { // Set the field property. oFields.item(nNodeCount).access = "readOnly"; } } } }
I would like to know if you want...
Nith
-
How to store the SQL in the oracle table?
I tried this way:
SQL > insert into sql_text values ('select invoice, invoice_dt, DT_INVOICED from PS_BI_HDR where DT_INVOICED = 21)
(Jan - 2010' and BILL_STATUS ='INV ");
Insert in sql_text values ('select invoice, invoice_dt, DT_INVOICED from PS_BI_HDR where DT_INVOICED = 21 - JAN-)
010' and BILL_STATUS ='INV ")
*
ERROR on line 1:
ORA-00917: lack of comma
Please help to solve, I can't use the concatenation (|)
coz
It is dynamic.'select invoice,invoice_dt,DT_INVOICED from PS_BI_HDR where DT_INVOICED= '21-JAN-2010' and BILL_STATUS='INV' '
user2060331 wrote:
No sql statement is a dynamic value inserted by a user to execute on the SQl prompt.Then use q-literals:
SQL> ACCEPT stmt PROMPT "Enter statement: " Enter statement: select invoice,invoice_dt,DT_INVOICED from PS_BI_HDR where DT_INVOICED= '21-JAN-2010' and BILL_STATUS='INV' SQL> insert into sql_text values('&stmt'); old 1: insert into sql_text values('&stmt') new 1: insert into sql_text values('select invoice,invoice_dt,DT_INVOICED from PS_BI_HDR where DT_INVOICED= '21-JAN-2010' and BILL_STATUS='INV'') insert into sql_text values('select invoice,invoice_dt,DT_INVOICED from PS_BI_HDR where DT_INVOICED= '21-JAN-2010' and BILL_STATUS='INV'') * ERROR at line 1: ORA-00917: missing comma SQL> insert into sql_text values(q'[&stmt]'); old 1: insert into sql_text values(q'[&stmt]') new 1: insert into sql_text values(q'[select invoice,invoice_dt,DT_INVOICED from PS_BI_HDR where DT_INVOICED= '21-JAN-2010' and BILL_STATUS='INV']') 1 row created. SQL>
SY.
Maybe you are looking for
-
Qosmio F20 - 437 Application error
Hello I use the recovery disk to restore my Qosmio F20 to factory settings, an application error 437 a popoed upward during the reimageing process.I remember upgrading the RAM, and I don't have the original with me. Any help will be appreciated.Thank
-
Re: HP Designjet 130nr... solved
Hello I have problem my printer HP Designjet 130nr at each startup, it still shows 3 pages by aligning the test print heads. Thank you for your help
-
Pavilion 15-r210nk: keboard
I recently tried to clean my keyboard, but when I removed my up & arrow down keys that I tried to get them back but I couldn't Help if possible? I really could not fix and thank you in advance
-
Even though I am the administrator, when I try to turn on automatically incident reports and solutions is dimmed and the help prompt indicates it needs to be done by the system administrator... but it's me! Click Advanced settings, but which is all