How to write the SQL without using dynamic SQL?
How can you write this under SQL without using execute immediately?
You can use static SQL (using something like a CASE statement)?
test procedure (one in varchar2, b number, each number) is
v_num_recs pls_integer;
Start
Select count (*)
in v_num
FROM table1
where
col1 = one and
If b is not null then col2 = b
If c is not null then col3 = c;
/ * i.e. If b is not null, where condition to add this line only. If c is not null, where condition should add only this line. OR condition No. it * /.
dbms_output.put_line (v_num);
end;
Or should I use dynamic SQL statements for this?
I was wondering if the two are NOT NULL? Well check this.
Select count (*) in v_num
table
where col1 = one
and col2 = (CASE WHEN (b is not null) THEN b ELSE END col2)
and col3 = (CASE WHEN (c is not null) THEN ELSE END col3 c)
Tags: Database
Similar Questions
-
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 view the content without using webcenter services - workflow?
Nice day!
I wanted to create a portlet where I can view and update xml retrieved from the UCM Content Server content. How can I do this without using taskflows (webcenter services)?
Thanks in advance!
KeithUse the RIDC connector with service GET_FILE to get the XML document... then back in the CHECKIN_UNIVERSAL service to check. There should be some samples in the download "content integration suite" here:
http://www.Oracle.com/technology/software/products/content-management/index.html
http://download.Oracle.com/OTN/content_management/ContentIntegrationSuite_10gR3_20081218.zip -
How to write the Sql values in the Application Engine
I am trying to write dynamic sql statements in AE
E.g.
I have SQL n Action
DELETE
OF %Table(%BIND(RECNAME))
WHERE Bind (FIELDNAME) = % (AMIT_VALUE_TO_DEL) Bind %;
at runtime, it converts into
DELETE
OF PS_TABLE1
WHERE 'EMPLID '=' AJ23;
THE QUOTATION MARK SINGLE AROUND EMPLID IN WHERE CLAUSE CREATES PROBLEM BCZ, IT IS A COLUMN NAME, IS THERE A SOLUTION THIS?Add NOQUOTES to your % Bind(). For example, % (FIELDNAME, NOQUOTES) Bind.
I must warn you however. When generating dynamic SQL, make sure that you have absolute control over the input text used to generate the SQL statement. For example, make sure that you, not a user, determines the value of RECNAME and FIELDNAME. It is too easy to create a SQL Injection flaw in converting the values entered by the user in SQL statements.
-
How to import the video without using a SD card
OK, so I am really new to adobe first, so this may be something obvious, but I tried all the advice on the forums and still can not understand. If you answer this question, please use the very basic language because I'm still learning what that means and how to use first. I'm trying to import video to my project, but the images says Offline Media. It works fine when the SD card is in my computer, but I would like to use the SD card to other projects, so I copied the files on a hard drive external and even tried to put it on my computer and it says Media Offline. Media link does not work either and sometimes I get the message waiting media, but it stays on never instead of display the clip I need. Let me know what other information you need and I'll answer as best I can.
You must copy the structure of the entire map of the SD card on your outside, not only the video files.
On Mac OS, you simply swipe the card externally and it will copy and appear on the outside like a folder. Don't know if the applies to windows.
Once it is finished, eject the SD card, restart the first and when the media rises in offline mode, select all media files in the media browser offline, and plugging it back in by pointing first to the location you copied your full SD card.
MtD
-
How to set the settings without using the name?
In my OpenGL\DirectX C++ engine that I wrote a material format clever for managing shader and texture settings, I do the same Molehill help now, but I can't find a way to know a registration number parameter.
I use PixelBender3D shaders, I want to use setProgramConstantsFromMatrix and setProgramConstantsFromVector to set my values instead of this helper class settings that allow you to by name (things with strings during execution should never used in vidogames and store name instead of the register number is just more painful)
I have seen that there is a ParameterRegisterInfo class, which inherits from RegisterInfo, that cointains a variable 'register', but it seems to be private, and I can't access the number of registry from there (I don't even know if register.baseNumber is really the one I need, but seems that Yes).
So, is it possible to get the registration number of a parameter to use with setProgramConstantsFromMatrix\setProgramConstantsFromVector?
If not, please, it implements! Functions such as setMatrixParameterByName are certainly useful, but should not be the only way to set a parameter.
I know that some of the samples use setProgramConstantsFromMatrix already, but every time the registry value is simply coded hard in and is not calculated.
I hope it's clear and thanks in advance!
This complaint has developed a couple of times since we released the beta version. You should have access to this information, we'll fix it in a future release.
-
help in the application without using the pivot function
Hi gurus,
Can you please help write the query without using the PIVOT function.
Thanks in advance!...WITH indata AS (SELECT 1 sn, '123:456,789,323:456,213,344,345:5454' x from dual UNION ALL SELECT 2, 'abcd:fgrfr,rfrf,rfred,tg:tg,tg:ophhh,op,vdfgbh:poijn' x from dual), instr AS (SELECT a.SN, rownum RN, B.column_value || CASE WHEN B.column_value NOT LIKE '%:%' THEN ':' END column_value FROM indata a, TABLE(CAST(multiset (SELECT trim(SUBSTR(x, (CASE LEVEL WHEN 1 THEN 1 ELSE instr(x, ',', 1, LEVEL - 1) + 1 END), (CASE instr(x, ',', 1, LEVEL) WHEN 0 then 4000 ELSE instr(x, ',', 1, LEVEL) - 1 - (CASE LEVEL WHEN 1 THEN 0 ELSE instr(x, ',', 1, level - 1) END) END))) FROM dual CONNECT BY level <= LENGTH(x) - LENGTH(REPLACE(x, ',', '')) + 1) AS sys.odcivarchar2list)) b) SELECT col1_val2, col1_val1, col2_val2, col2_val1, systimestamp FROM (select SN, ROW_NUMBER() over(partition by SN order by RN) RN, SUBSTR(column_value, INSTR(column_value, ':') + 1) VAL1, substr(column_value, 1, instr(column_value, ':') - 1) val2 FROM instr ) PIVOT(MAX(VAL1) VAL1, MAX(VAL2) VAL2 FOR SN IN(1 as col1,2 as col2));
Any help would be appreciated.user590978 wrote:
Can you please help write the query without using the PIVOT function.
with indata as ( select 1 sn,'123:456,789,323:456,213,344,345:5454' x from dual union all select 2, 'abcd:fgrfr,rfrf,rfred,tg:tg,tg:ophhh,op,vdfgbh:poijn' x from dual ), t1 as ( select x from indata where sn = 1 ), t2 as ( select x from indata where sn = 2 ), t3 as ( select level lvl, substr( x, instr(',' || x,',',1,level), instr(x || ',',',',1,level) - instr(',' || x,',',1,level) ) col1 from t1 connect by level <= length(x) - length(translate(x,'A,','A')) + 1 ), t4 as ( select level lvl, substr( x, instr(',' || x,',',1,level), instr(x || ',',',',1,level) - instr(',' || x,',',1,level) ) col2 from t2 connect by level <= length(x) - length(translate(x,'A,','A')) + 1 ), t5 as ( select lvl, substr(col1,1,instr(col1 || ':',':') - 1) col1_val1, substr(col1,instr(col1 || ':',':') + 1) col1_val2 from t3 ), t6 as ( select lvl, substr(col2,1,instr(col2 || ':',':') - 1) col2_val1, substr(col2,instr(col2 || ':',':') + 1) col2_val2 from t4 ) select col1_val1, col1_val2, col2_val1, col2_val2, systimestamp from t5 full join t6 on ( t6.lvl = t5.lvl ) order by coalesce(t5.lvl,t6.lvl) / COL1_VAL1 COL1_VAL2 COL2_VAL1 COL2_VAL2 SYSTIMESTAMP ---------- ---------- ---------- ---------- ------------------------------------- 123 456 abcd fgrfr 23-OCT-12 11.50.12.015000 AM -04:00 789 rfrf 23-OCT-12 11.50.12.015000 AM -04:00 323 456 rfred 23-OCT-12 11.50.12.015000 AM -04:00 213 tg tg 23-OCT-12 11.50.12.015000 AM -04:00 344 tg ophhh 23-OCT-12 11.50.12.015000 AM -04:00 345 5454 op 23-OCT-12 11.50.12.015000 AM -04:00 vdfgbh poijn 23-OCT-12 11.50.12.015000 AM -04:00 7 rows selected. SQL>
SY.
-
Hello
How to write the sql query
I have three type of table as
1 table emp
EMP_ID FIRST_NAME DEPT_ID
---------- -------------------- ----------
1 kumar 10
2 sam 20
3 30 damu
2 table dept
EMP_ID SALE_ID DEPT_ID
---------- ---------- ----------
1 101 10
2 102 20
3 103 30
3. table sale
EMP_ID SALE_ID SALE_AMT
---------- ---------- ----------
1 101 7
2 102 8
3 103 9
I want the result as
EMP_ID DEPT_ID SALE_AMT
------- --------- - --------
1 10 7
Thank you
Are you looking for this?
SELECT T1. EMP_ID,
T1. DEPT_ID,
W3M SALE_AMT
FROM EMP T1,
SALE T3
WHERE T1. EMP_ID = T3. EMP_ID;
OUTPUT:
EMP_ID DEPT_ID SALE_AMT
------- ---------- ----------
1 10 7
2 20 8
3 30 9
If this is not the case, after the actual output, you need. Because that gives you the amount of sales deptwise
-
How to view NTUSER. DAT file as to the registry without using it?
How to view NTUSER. DAT file as to the registry without using it?
The file is from a different Windows instalation!I have Win 7 but it comes from my old Windows xp.Hi Leonnis,
There are many ways to read the registry file without using regedit.Some ways:RegLookup: RegLookup project is dedicated to the direct analysis of Windows NT registry files. RegLookup is distributed under the GNU GPL license and is implemented in ANSI C. RegLookup provides a C API, a Python module and command line tools to access registry data structures.Download here: http://projects.sentinelchicken.org/reglookup/RegViewer: Is GTK 2.2 based registry Windows GUI file browser. It is platform-independent for the review of the files of Windows registry from any platform. Particularly useful in forensics files Windows of * nix systems.Download here: http://regviewer.sourceforge.netRegRipper:
RegRipper is an application of forensics software open source developed by Harlan Carvey. RegRipper, written in Perl, is a tool for extracting data from Windows registry.Download here: http://regviewer.sourceforge.netKRegedit:kregedit is a KDE utility for the visualization of the native Windows registry files. It is similar to the regedt32 utility that is found on most Windows platforms. Only the format of the NT (NT4/2000/XP) registry is supported.Paulo BreimCentro Brasileiro PericiaHelp, please!
-
I have paid the monthly fee and have been using Acrobat Pro DC. I had a problem where I broke my previous laptop and want to continue to use this product. I bought another laptop, and I don't know how to download the program without having to pay again. I pay $14,99 per month for this service, how can I download it without having to pay again?
Hello
Please download Acrobat Pro ms of the here. After you download the application, install and activate it by providing your Adobe ID
Thank you
Abhishek
-
How to set CC at the beginning of the project without using the CC button?
How to set CC at the beginning of the project without using the CC button? I want CC which by default and allow users to turn off if they do not need.
Hi again,
If you have a Standard Action, then just add a literal Assign cpCmndCC with 1 line. You can also follow what says Lieve, just add a short blade and apply the action on the second slide. Also if you have objects on the slide which advance to the next slide and then not using OnExit measures.
Thank you!
-
How to set a component at the bottom of the screen without using setStatus()
I created a custom horizontalFieldmanager and want to put it at the bottom of the main screen in my application. My custom horizontalFieldManager contains three fields of bitmap... help me please put it at the bottom of the screen without using the setstatus method.
OKS... If it is finally... Thanks for the help
-
How to write the select query for it
Hello
I had an html form and the area I drop down and he needs to select several values in the drop-down box. When I select multiple values then I have to write the query to SQL select statement.
When I try to write the select statement and trying to run I get the error message.
Select * from Table
where emo_no = '1,2,3 '.
That's how I write the query please suggest me how to write the query to select several values in the drop-down box.
Thank you
Use the keyword sql 'in '. If you don't know how, I've heard good things about the book Teach Yourself SQL in 10 Minutes by Ben Forta.
-
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 start the assessment without a device
Hello
I downloaded the evaluation version.
How to start the assessment without a device?
Thank you
DV63
Hi DV63,
Welcome to the Forums EITHER!
If you downloaded an evaluation version of LabVIEW your 30 day trial must begin immediately after being invited to enter a serial number. You can choose not to enter a serial number and this will begin your trial period. I recommend that you install OR-DAQmx device drivers; It is a software that allows you to communicate with the hardware from National Instruments DAQ. However, this facility will be particularly useful because it allows you to simulate an Instrument with the measurement and Automation Explorer (MAX); This means that you can immediately start the signals in LabVIEW.
Maybe you are looking for
-
Synchronizing messages with iOS 10 and Mac OS
I recently got an iPhone 7, and I'm looking to synchronize messages with my MacBook Air. Unfortunately, I had problems with this. According to the countless community boards is a key step in the synchronization of messages between mac and iPhone sele
-
Could not do a monthly subscriptions even call made? can I be reimbursed?
Hi I recently bought a monthly subscription, but I really struggled to communicate with friends via Skype monthly subscription telephone calls - and finally I just gave up, as we could not really speak this end via Skype - Skype subscription to their
-
My last two routers in Apple both lasted 14 months more I had an arrival of DAO. Of course, both just went out of warranty. My current A.E. seems must be reset to zero every day even if it is shows that it works, my devices loose their connection. Re
-
Is there a place to find serscan.sys on a laptop Toshiba Satellite A305, running Windows Vista Home Premium 64 bit? My Installer to connect wireless to a new HP Officejet Pro 8600 wireless all-in-one printer-scanner-copier-fax machine tells me to fi
-
Vst 5645r PXI gain / attenuation calibration chain RX TX
Hello I work with PXI vst 5645r. I did some research using the RF output of the transmitter connected with the receiver RF input. In my application, it is important to know the equivalent mitigation and win I get (output of the DAC) generation up to