Getting error after putting variable in select statement
Hi All,
Kindly help me with Pl/sql code
here i'm trying to put variable in select statement ....
I successfully put the Yr and Mnth ..but getting error for loop variable "i"
Here i'm getting error that too because of " i" only-->TRIM(UPPER(TO_CHAR(TO_DATE(i||'-'||Mnth||'-'||Yr,'dd-Mon-YYYY'),'DAY')))
Please find the full code below.
Declare
Yr number not null:=2010;
Mnth varchar2(20) not null:='Jun';
v_val number:=0;
begin
for i in 1..2 loop
case i
SELECT count(*) into v_val
FROM DUAL
WHERE TRIM(UPPER(TO_CHAR(TO_DATE(i||'-'||Mnth||'-'||Yr,'dd-Mon-YYYY'),'DAY')))
in (UPPER('Monday'),UPPER('Tuesday'),UPPER('WEDNESDAY'),UPPER('THURSDAY'),UPPER('friday'))
end case;
end loop;
end;
Declare
Yr number not null:=2010;
Mnth varchar2(20) not null:='Jun';
v_val number:=0;
begin
for i in 1..2 loop
SELECT count(*) into v_val
FROM DUAL
WHERE TRIM(UPPER(TO_CHAR(TO_DATE(i||'-'||Mnth||'-'||Yr,'dd-Mon-YYYY'),'DAY')))
in (UPPER('Monday'),UPPER('Tuesday'),UPPER('WEDNESDAY'),UPPER('THURSDAY'),UPPER('friday'));
end loop;
end;
Similar Messages
-
Bind Variable in SELECT statement and get the value in PL/SQL block
Hi All,
I would like pass bind variable in SELECT statement and get the value of the column in Dynamic SQL
Please seee below
I want to get the below value
Expected result:
select distinct empno ,pr.dept from emp pr, dept ps where ps.dept like '%IT' and pr.empno =100
100, HR
select distinct ename ,pr.dept from emp pr, dept ps where ps.dept like '%IT' and pr.empno =100
TEST, HR
select distinct loc ,pr.dept from emp pr, dept ps where ps.dept like '%IT' and pr.empno =100
NYC, HR
Using the below block I am getting column names only not the value of the column. I need to pass that value(TEST,NYC..) into l_col_val variable
Please suggest
----- TABLE LIST
CREATE TABLE EMP(
EMPNO NUMBER,
ENAME VARCHAR2(255),
DEPT VARCHAR2(255),
LOC VARCHAR2(255)
INSERT INTO EMP (EMPNO,ENAME,DEPT,LOC) VALUES (100,'TEST','HR','NYC');
INSERT INTO EMP (EMPNO,ENAME,DEPT,LOC) VALUES (200,'TEST1','IT','NYC');
INSERT INTO EMP (EMPNO,ENAME,DEPT,LOC) VALUES (300,'TEST2','MR','NYC');
INSERT INTO EMP (EMPNO,ENAME,DEPT,LOC) VALUES (400,'TEST3','HR','DTR');
INSERT INTO EMP (EMPNO,ENAME,DEPT,LOC) VALUES (500,'TEST4','HR','DAL');
INSERT INTO EMP (EMPNO,ENAME,DEPT,LOC) VALUES (600,'TEST5','IT','ATL');
INSERT INTO EMP (EMPNO,ENAME,DEPT,LOC) VALUES (700,'TEST6','IT','BOS');
INSERT INTO EMP (EMPNO,ENAME,DEPT,LOC) VALUES (800,'TEST7','HR','NYC');
COMMIT;
CREATE TABLE COLUMNAMES(
COLUMNAME VARCHAR2(255)
INSERT INTO COLUMNAMES(COLUMNAME) VALUES ('EMPNO');
INSERT INTO COLUMNAMES(COLUMNAME) VALUES ('ENAME');
INSERT INTO COLUMNAMES(COLUMNAME) VALUES ('DEPT');
INSERT INTO COLUMNAMES(COLUMNAME) VALUES ('LOC');
COMMIT;
CREATE TABLE DEPT(
DEPT VARCHAR2(255),
DNAME VARCHAR2(255)
INSERT INTO DEPT(DEPT,DNAME) VALUES ('IT','INFORMATION TECH');
INSERT INTO DEPT(DEPT,DNAME) VALUES ('HR','HUMAN RESOURCE');
INSERT INTO DEPT(DEPT,DNAME) VALUES ('MR','MARKETING');
INSERT INTO DEPT(DEPT,DNAME) VALUES ('IT','INFORMATION TECH');
COMMIT;
PL/SQL BLOCK
DECLARE
TYPE EMPCurTyp IS REF CURSOR;
v_EMP_cursor EMPCurTyp;
l_col_val EMP.ENAME%type;
l_ENAME_val EMP.ENAME%type;
l_col_ddl varchar2(4000);
l_col_name varchar2(60);
l_tab_name varchar2(60);
l_empno number ;
b_l_col_name VARCHAR2(255);
b_l_empno NUMBER;
begin
for rec00 in (
select EMPNO aa from EMP
loop
l_empno := rec00.aa;
for rec in (select COLUMNAME as column_name from columnames
loop
l_col_name := rec.column_name;
begin
l_col_val :=null;
l_col_ddl := 'select distinct :b_l_col_name ,pr.dept ' ||' from emp pr, dept ps where ps.dept like ''%IT'' '||' and pr.empno =:b_l_empno';
dbms_output.put_line('DDL ...'||l_col_ddl);
OPEN v_EMP_cursor FOR l_col_ddl USING l_col_name, l_empno;
LOOP
l_col_val :=null;
FETCH v_EMP_cursor INTO l_col_val,l_ename_val;
EXIT WHEN v_EMP_cursor%NOTFOUND;
dbms_output.put_line('l_col_name='||l_col_name ||' empno ='||l_empno);
END LOOP;
CLOSE v_EMP_cursor;
END;
END LOOP;
END LOOP;
END;user1758353 wrote:
Thanks Billy, Would you be able to suggest any other faster method to load the data into table. Thanks,
As Mark responded - it all depends on the actual data to load, structure and source/origin. On my busiest database, I am loading on average 30,000 rows every second from data in external files.
However, the data structures are just that - structured. Logical.
Having a data structure with 100's of fields (columns in a SQL table), raise all kinds of questions about how sane that structure is, and what impact it will have on a physical data model implementation.
There is a gross misunderstanding by many when it comes to performance and scalability. The prime factor that determines performance is not how well you code, what tools/language you use, the h/w your c ode runs on, or anything like that. The prime factor that determines perform is the design of the data model - as it determines the complexity/ease to use the data model, and the amount of I/O (the slowest of all db operations) needed to effectively use the data model. -
Getting error java.lang.NullPointerException while selection LOV
I am getting error java.lang.NullPointerException while selecting LOV. Please help
SEVERE: Server Exception during PPR, #1
javax.servlet.ServletException
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:277)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:181)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:85)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:279)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._invokeDoFilter(TrinidadFilterImpl.java:239)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:196)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:139)
at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
at oracle.security.jps.wls.JpsWlsFilter.doFilter(JpsWlsFilter.java:102)
at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:65)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
at oracle.adf.library.webapp.LibraryFilter.doFilter(LibraryFilter.java:149)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3496)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(Unknown Source)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2180)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2086)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1406)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
Caused by: java.lang.NullPointerException
at oracle.adfinternal.view.faces.model.binding.RowDataManager.setRowKey(RowDataManager.java:129)
at oracle.adfinternal.view.faces.model.binding.FacesCtrlHierBinding$FacesModel.setRowKey(FacesCtrlHierBinding.java:530)
at org.apache.myfaces.trinidad.component.UIXCollection.setRowKey(UIXCollection.java:429)
at oracle.adfinternal.view.faces.renderkit.rich.TableRendererUtils.decodeSelectedRowKeys(TableRendererUtils.java:470)
at oracle.adfinternal.view.faces.renderkit.rich.table.BaseTableRenderer.decodeIncompatiblePropertyKey(BaseTableRenderer.java:208)
at oracle.adf.view.rich.render.RichRenderer.decode(RichRenderer.java:203)
at org.apache.myfaces.trinidad.component.UIXComponentBase.__rendererDecode(UIXComponentBase.java:1089)
at org.apache.myfaces.trinidad.component.UIXComponentBase.decode(UIXComponentBase.java:714)
at org.apache.myfaces.trinidad.component.UIXTable.decode(UIXTable.java:136)
at org.apache.myfaces.trinidad.component.UIXCollection.processDecodes(UIXCollection.java:193)
at org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildrenImpl(UIXComponentBase.java:970)
at org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildren(UIXComponentBase.java:956)
at org.apache.myfaces.trinidad.component.UIXComponentBase.processDecodes(UIXComponentBase.java:812)
at org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildrenImpl(UIXComponentBase.java:970)
at org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildren(UIXComponentBase.java:956)
at org.apache.myfaces.trinidad.component.UIXComponentBase.processDecodes(UIXComponentBase.java:812)
at org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildrenImpl(UIXComponentBase.java:970)
at org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildren(UIXComponentBase.java:956)
at oracle.adf.view.rich.component.UIXPopup.processDecodes(UIXPopup.java:60)
at org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildrenImpl(UIXComponentBase.java:970)
at org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildren(UIXComponentBase.java:956)
at oracle.adf.view.rich.component.UIXInputPopup.processDecodes(UIXInputPopup.java:137)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl$ApplyRequestValuesCallback.invokeContextCallback(LifecycleImpl.java:1113)
at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:722)
at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:731)
at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:731)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.invokeOnComponent(ContextSwitchingComponent.java:153)
at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:731)
at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:731)
at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:731)
at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:731)
at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:731)
at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:731)
at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:731)
at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:731)
at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:731)
at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:731)
at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:731)
at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:731)
at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:731)
at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:731)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.invokeOnComponent(ContextSwitchingComponent.java:153)
at oracle.adf.view.rich.component.fragment.UIXPageTemplate.invokeOnComponent(UIXPageTemplate.java:208)
at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:731)
at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:731)
at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:731)
at javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:664)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:303)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:175)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
... 29 moreDuplicate: Re: Get null pointer exception while selecting LOV for a parameter form object
-
When i am on the 4 step in Search Result Display options, i get errors after 2 radio buttons
I am using Oracle portal 9.0.2 version
When i am on the 4 step in Search Result Display options, i get errors after 2 radio buttons
Default Search Results Page
This Search Portlet
An unexpected error has occurred (WWS-32100)
User-Defined Exception (WWS-11230)
Unknown Exception (WWC-45131)
ORA-20101:
ORA-06512: at "PORTAL.WWSBR_STDERR", line 437
ORA-06512: at "PORTAL.WWPOB_API_PAGE", line 3369
ORA-01403: no data found
ORA-01403: no data found (WWC-11230)
No data found (WWS-32101)
ORA-1403: ORA-01403: no data found
ORA-01403: no data found (WWC-36000)
Error: An unexpected error occurred: User-Defined Exception (WWC-43000)
Please help me with this one
P.S I tried to run inctxgrn.sql, but it did not solve the problemi solved the problem by runing 2 scripts as a portal user
You can refer to bug - 2418089. This was fixed in 9.0.2.3
begin
wwpre_api_value.set_value_as_number
p_path => 'oracle.portal.search',
p_name => 'searchresultpageid',
p_level_type => wwpre_api_value.SYSTEM_LEVEL_TYPE,
p_level_name => null,
p_value => 6,
p_commit => true
commit;
end;
begin
wwpre_api_value.set_value_as_number
p_path => 'oracle.portal.search',
p_name => 'searchresultpagesiteid',
p_level_type => wwpre_api_value.SYSTEM_LEVEL_TYPE,
p_level_name => null,
p_value => 6,
p_commit => true
commit;
end;
NOTE - The difference is the value of 'p_name' attribute. If u see carefully it is 'searchresultpagesiteid'. The first time u run this the value is 'searchresultpageid'. -
Getting error after installing admt 3.2
hi team
i am getting error after installing the admt 3.2 on server 2008 R2 where i have installed sql server 2008 sp1 with express edition
the server is a DC
the error is "Unable to check for failed actions. :DBManager.IManageDB.1 Unable to retrieve the database file pagth from the registry. the system cannot find the file specified"
Thanks,
virajYou should change the forum type on this to a question. The way you have this labled as a discussion not a problem.
See if the link below helps you out.
http://support.microsoft.com/kb/2266373
Paul Bergson
MVP - Directory Services
MCITP: Enterprise Administrator
MCTS, MCT, MCSE, MCSA, Security+, BS CSci
2008, Vista, 2003, 2000 (Early Achiever), NT4
http://www.pbbergs.com Twitter @pbbergs
http://blogs.dirteam.com/blogs/paulbergson
Please no e-mails, any questions should be posted in the NewsGroup. This posting is provided "AS IS" with no warranties, and confers no rights. -
Tree Table Error : Missing from in a select statement
Created a view link
Created a view criteria on source vo which has attribute of destination vo
Dragged the source view criteria to form a tree table.
But upon invoke of jspx page even if tree table is appearing Error : Missing from in a select statement is shown. Log shows no specific file/line number. Search is also throwing same error
If i remove attribute of destination vo from view criteria error is not appearing. Any pointers?Hi,
Well, If the user always enter a list as selection (no range, exclusion, ...), I can understand the need.. otherwise this is indeed a bit strange... In case they only need to use single element list in SO, you could restrict all other SO features with the FM SELECT_OPTIONS_RESTRICT and then loop on values and select each single vendor...
E.g under your INITIALIZATION event:
* Only option 'EQ' and sign 'I' are allowed
lt_opt_list-name = 'ONLY_EQ'.
lt_opt_list-options-eq = 'X'.
APPEND lt_opt_list TO ls_restriction-opt_list_tab.
lt_***-kind = 'S'. "select-option
lt_***-name = 'S_LIFNR'. "name of select-option
lt_***-sg_main = 'I'. "only inclusive
lt_***-sg_addy = space.
lt_***-op_main = 'ONLY_EQ'.
lt_***-op_addy = space.
APPEND lt_*** TO ls_restriction-***_tab.
CALL FUNCTION 'SELECT_OPTIONS_RESTRICT'
EXPORTING
restriction = ls_restriction
EXCEPTIONS
too_late = 1
repeated = 2
selopt_without_options = 3
selopt_without_signs = 4
invalid_sign = 5
empty_option_list = 6
invalid_kind = 7
repeated_kind_a = 8
OTHERS = 9.
Then just loop on SO table, select single and check subrc...
Kr,
Manu. -
Getting an ORA-24333 error while parsing a non SELECT statement ...
Hi,
I'm new to this forum and I've search through the entire forum to see if my problem was already solved, but at first sight it doesn't ?
So I hope that someone can help me one this : I'm facing a strange problem with the OCI 8i. I've encapsulated any OCI call into a set of C++ classes. Everything works fine apart for one point : whenever I try to parse a NON "select" statement, I get the ORA-24333 error.
Basically, the code follow the current schema (only "important" states are written here) :
-> Opening an Oracle Session
-> Receving de statement.
-> Analyse it with a call to OCIStmtPrepare() with OCI_NTV_SYNTAX set.
-> Calling OCIBindByName() to associate each variable with a data.
-> Calling OCIStmtExecute() with OCI_DESCRIBE_ONLY set in order to retrieve the current list of INPUT/OUTPUT columns.
And this is where the problem arise.
With a statement like : "SELECT MyPackage.MyFunction(:v1) FROM DUAL"
Everthing works fine. I can bind the INPUT/OUTPUT ":v1" variable.
But with a statement like : "BEGIN MYFUNTION(:v1); END;"
I get the ORA-24333 error after the call to OCIStmtExecute().
I get this error only when I set OCI_DESCRIBE_ONLY. If I call OCIStmtExecute() with OCI_DEFAULT, the OCI execute the statement. This is fine but it's not what I want. I cannot change the statement received (by design), so they should be proceeded as received.
What I'm looking for is a way to successfully perform the OCIStmtExecute() with OCI_DESCRIBE_ONLY set in order to get the list of variables columns related to the current statement.
Any help would be greatly apprecitated here. Thanks !
Here are my current configurations.
-> Windows 2000 SP5 OCI 8i / VC++ 6.0
-> Macintosh OS X 10.3.4 / Code Warrior 8.3
(The code produce exactly the same results/troubles on both plateforms.)
Thanks in advance for your respons.Hi,
I'm new to this forum and I've search through the entire forum to see if my problem was already solved, but at first sight it doesn't ?
So I hope that someone can help me one this : I'm facing a strange problem with the OCI 8i. I've encapsulated any OCI call into a set of C++ classes. Everything works fine apart for one point : whenever I try to parse a NON "select" statement, I get the ORA-24333 error.
Basically, the code follow the current schema (only "important" states are written here) :
-> Opening an Oracle Session
-> Receving de statement.
-> Analyse it with a call to OCIStmtPrepare() with OCI_NTV_SYNTAX set.
-> Calling OCIBindByName() to associate each variable with a data.
-> Calling OCIStmtExecute() with OCI_DESCRIBE_ONLY set in order to retrieve the current list of INPUT/OUTPUT columns.
And this is where the problem arise.
With a statement like : "SELECT MyPackage.MyFunction(:v1) FROM DUAL"
Everthing works fine. I can bind the INPUT/OUTPUT ":v1" variable.
But with a statement like : "BEGIN MYFUNTION(:v1); END;"
I get the ORA-24333 error after the call to OCIStmtExecute().
I get this error only when I set OCI_DESCRIBE_ONLY. If I call OCIStmtExecute() with OCI_DEFAULT, the OCI execute the statement. This is fine but it's not what I want. I cannot change the statement received (by design), so they should be proceeded as received.
What I'm looking for is a way to successfully perform the OCIStmtExecute() with OCI_DESCRIBE_ONLY set in order to get the list of variables columns related to the current statement.
Any help would be greatly apprecitated here. Thanks !
Here are my current configurations.
-> Windows 2000 SP5 OCI 8i / VC++ 6.0
-> Macintosh OS X 10.3.4 / Code Warrior 8.3
(The code produce exactly the same results/troubles on both plateforms.)
Thanks in advance for your respons. -
Storing variable from select statement
I need to store a variable from a select statement into a session. Before I was taken what was passed from another page and throwing it into a session.--
String Password= request.getParameter("Password");
String sql = "Select WEB_USER_ID FROM Web_User WHERE PASSWORD = '" + Password +"'";
session.setAttribute("USER",Password);
Now though I need to put in Web_User_Id and cannot find the proper syntax. Can someone help
session.setAttribute("User",???????);WEB_USER_ID is unidentified because it is a column name, not a variable name. You should first assign its value to a variable and then put the variable name into the setAttribute statement instead.
Your query may return more than one result based on the way it is written. It sounds like you are trying to find all users with a password that is equal to the value of Password. If this is correct, then are you trying to create an attribute for each user?
If your intention is to locate a user, then the user id and password should have been provided. A variable should be defined for both the password and user id. You should then add the user id to the where clause. After a successful search, the attributes can be created using the same syntax. -
Using variable in select statement (php)
I am having difficulty using a variable in a select
statement.
The following manual query (using a static date) works fine:
$query_Recordset1 = "SELECT * FROM academyClasses WHERE
classDate > '2006-06-01' ";
However, If I use the following:
$dateVar = date('Y-m-d');
mysql_select_db($database_mw, $mw);
$query_Recordset1 = "SELECT * FROM academyClasses WHERE
classDate > $dateVar ";
ALL records are returned, which means the $dateVar variable
is not being recognized. I have compared the $dateVar values
<?php echo $datetime; ?> against the actual value of my date
field <?php echo $row_Recordset1['classDate']; ?> in my
results table and it seems that the values are indeed accurate in
terms of a date 2006-06-04 for example.
My date field "classDate" is of a "date" type within the
mysql database. I'm using Dreamweaver MX 2004 with Mac OSX 10.3.9.
I'm sure this is just a syntax problem, at least I hope it
is.
Any help is greatly appreciated.On Wed, 7 Jun 2006 04:49:57 +0000 (UTC), "mgwaters"
<[email protected]> wrote:
>Thanks Gary. That did seem to get the select statement
working, but I had to
>enter a manual date as before $dateVar = '2006-06-01'; on
the previous line of
>code to actually get it to filter my records. So... it
looks like my setting of
>the date variable:
> $dateVar = date('Y-m-d');
> does not seem to be recognized within the SELECT
statement.
Try this:
$query_Recordset1 = "SELECT * FROM academyClasses WHERE
classDate>'$dateVar'";
print $query_Recordset1;
See what is in the SQL statement.
Gary -
Getting error in cursor variable in CallableStatement
Hi,
I am trying to retrieve result set from PL/SQL procedure using cursor variable.
but I getting error sometime.
this is code in my program...
CallableStatement pstmt=null;
pstmt = con.prepareCall("{call Crms2.SearchRNameTime(?,?,?,?,?,?)}");
pstmt.setString(1, uid);
pstmt.setString(2, strBookingDate);
pstmt.setInt(3, roomid);
pstmt.setInt(4, lngStartTime);
pstmt.setInt(5, lngEndTime);
pstmt.registerOutParameter(6, oracle.jdbc.driver.OracleTypes.CURSOR ); // error accured in this line
pstmt.execute();
rs = (ResultSet)pstmt.getObject(6);
error was accrued at line : pstmt.registerOutParameter(6, oracle.jdbc.driver.OracleTypes.CURSOR );
error is: orable.jdbc.driver can not resolve tha symbol..
but it some time executing , some time giving error.
it is require any package to import?
please help me on this problem.
regards
Narru990187 wrote:
i have created a cursor to return only 5th row from a table .
declare
cursor cur is select * From(select last_name,salary,rownum rn from employees where rownum<=50)) where rn=5;
just a side note, (others have helped with the actual error already), using "rownum" like you do isn't very consistent. Not really sure about the requirment of "5th row", but no matter. Just keep in mind that the way Oracle assigns a rownum, and the fact you have no sorting/order ... you are - effectively - getting a random row. That is, with no data changing, Oracle may very well retrieve things in a different order due to index, new oracle version, whatever.
If you do actually need the 5th row where you have some sorting (ie 5th largest salary, or 5th record by last name, etc. ), then you may want to consider something like:
select * from (select last_name, salary, row_number() over (order by salary desc) rn from employees) where rn = 5;
or whatever your sort criteria is. Do a search for "Top N" queries if you need more info.
It'll work a bit more consistently. -
Getting Username to pass into LOV select statement
Hello!
I'm wondering if its possible to get the username of the current user logged in and pass it as a variable into a select statement used in a dynamic LOV in Oracle AS Portal?
What I'm attempting to do is pull all the values from a table that equal the current user's username to user on a portal report
so (as a rough example)
select color from mytable where username = 'whatever the user name is would be here'
And then the current user would get a list of values from which to select based off of the values entered in this table.
The issue I'm having is determing how to fill the 'whatever the user name is would be here' portion with the actual logged in user's username (or even if its possible). I know on the actual portal one can do #USER.FULLNAME# to display their username, is there a similar "variable" one may use to get the username for a LOV sql call?
I can get it to work if I statically fix the username to a particular value (ex: where username = 'Joe.Hacker') but I'm unsure if theres a variable or bind value (for lack of a better term) to grab the username on the fly.. dynamically.portal.wwctx_api.get_user can be used in the SQL query of your portal report to get the user_name of the currently logged-in portal user. For more info on wwctx_api, see the 10.1.2 or 10.1.4 portal API docs at http://www.oracle.com/technology/products/ias/portal/html/plsqldoc/pldoc1012/index.html or http://www.oracle.com/technology/products/ias/portal/html/plsqldoc/pldoc1014/index.html
-
Help me! I get error after install window on bootcamp
I use bootcamp to create usb window 7
But I cannot install window on bootcamp drive
After that, I restart but I get error cannot boot on black screen, help meYou need to select the BOOTCAMP Partition and click on Format. After the Installer formats it from FAT to NTFS, you should be able to install Windows.
These screens from a Mac, which does not have Recovery HD, so the numbering is different.
Reference - https://help.apple.com/bootcamp/mac/5.0/help/#/bcmp173b3bf2 -
Getting error for bind variables
Hello Experts ;
SQL> DECLARE
2 l_eid number;
3 l_name varchar2(30);
4 BEGIN
5 l_eid:=1000;
6 select name into l_name from tab1 where no = l_eid;
7 l_eid:=9999;
8 select name into l_name from tab1 where no = l_eid;
9 l_eid:=299999;
10 select name into l_name from tab1 where no = l_eid;
11* END;
PL/SQL procedure successfully completed.
when creating bind variables i am getting error :
SQL> variable b1 number;
SQL> exec :b1 :='select name from tab1 where no = :b1';
BEGIN :b1 :='select name from tab1 where no = :b1'; END;
* ERROR at line 1:
ORA-06502: PL/SQL: numeric or value error: character to number conversion error
ORA-06512: at line 1@ SY
SolomonYakobson wrote:
You need to explain "method not workable for me". I have no idea what method you are talking about and what are you trying to achieve.
SY.
SQL>DECLARE
v_value number;
v_dispaly varchar2(30);
BEGIN
v_value :=100000;
select name into v_display from tab1 where no = :v_value;
DBMS_OUTPUT.PUT_LINE(v_display);
v_value :=20000;
select name into v_display from tab1 where no = :v_value;
DBMS_OUTPUT.PUT_LINE(v_display);
v_value :=250000;
select name into v_display from tab1 where no = :v_value;
DBMS_OUTPUT.PUT_LINE(v_display);
* END;
RS>/
PL/SQL procedure successfully completed.
>> This is not workable for me , Here getting error >>
SQL> DECLARE
2 variable b1 number;
3 exec :b1;
4 BEGIN
5 select name from tab1 where no =: b1;
6* END;
RS>/
variable b1 number;
ERROR at line 2:
ORA-06550: line 2, column 13:
PLS-00103: Encountered the symbol "NUMBER" when expecting one of the following:
:= . ( @ % ; not null range default character
Thanks ! -
Getting error while uploading Product Foundation Selection Set
Hi,
While uploading the extract of Product Foundation selection set, I am getting the error in the Code Combinations API.
The error is :
An unexpected error has occurred. Please inform your system administrator that the error: ORA-12899: value too large for column "GL"."GL_CODE_COMBINATIONS"."DETAIL_POSTING_ALLOWED_FLAG" (actual: 3, maximum: 1) occurred when the FND_FLEX_SERVER package tried to execute the SQL statement below.
If tables or sequences do not exist this may indicate a problem with your installation. Make sure grants and synonyms exist so that all tables, views, and sequences in the SQL statement are visible from the database account in which the FND_FLEX_SERVER package resides (usually APPLSYS).
If this is a select statement and the last portion of the where clause is in incorrect, then an invalid where clause may have been supplied in the flexfield definition. The error is probably either in the form, or in a server-side package that calls the flexfield validation routine.
SQL statement (first 1000 bytes):
insert into GL_CODE_COMBINATIONS (CODE_COMBINATION_ID, CHART_OF_ACCOUNTS_ID, ENABLED_FLAG, SUMMARY_FLAG, START_DATE_ACTIVE, END_DATE_ACTIVE, LAST_UPDATE_DATE, LAST_UPDATED_BY, DETAIL_BUDGETING_ALLOWED_FLAG, DETAIL_POSTING_ALLOWED_FLAG, ACCOUNT_TYPE, REFERENCE3, JGZZ_RECON_FLAG, SEGMENT1, SEGMENT2, SEGMENT3, SEGMENT4, SEGMENT5, SEGMENT6) values (:FND_BIND1,:FND_BIND2,:FND_BIND3,:FND_BIND4,:FND_BIND5,:FND_BIND6,sysdate,:FND_BIND7,:FND_BIND8,:FND_BIND9,:FND_BIND10,:FND_BIND11,:FND_BIND12,:FND_BIND13,:FND_BIND14,:FND_BIND15,:FND_BIND16,:FND_BIND17,:FND_BIND18)
The value of Detail Posting Allowed Flag = 'Y' only. I am afraid if API is counting quotes (') as a separate character. And if this is the case, then do we have any patch for the same?Hi,
We are on 12.1.1 version and we are in the process to download below mentioned patches.
1) 8602263 -- Generic Platform (American English)
2) 8652905 -- Generic Platform (American English)
3) 8661732 -- Generic Platform (American English)
4) 8599456 -- Linux x86 (American English)
But while downloading we are facing some issues. Once we find the patch from Support.oracle.com and click on download, it is displaying a page with error. Still we are trying to find out if there is something wrong with our network connection. In the meanwhile, if possible, request you to check if the Download is working fine at your end from Support.oracle.com
And as we dont have privilage to raise an SR, I am not able to download the 5th patch related to GL.
Appreciate your help ("as always") as I have completed the entire Selection, Extraction and Transformation part and now waiting to Load Product Foudnation Extract so that Ledger will start appearing in the system.
With Regards,
Vishal majithia -
How to use column name as variable in select statement
hi,
i want to make a sql query where in select statement using variable as a column name. but its not working plz guide me how can i do this.
select :m1 from table1;
regardsHi,
Is this what you want..
SQL> select &m1 from dept;
Enter value for m1: deptno
old 1: select &m1 from dept
new 1: select deptno from dept
DEPTNO
10
20
30
40
SQL> select &m1 from dept;
Enter value for m1: dname
old 1: select &m1 from dept
new 1: select dname from dept
DNAME
ACCOUNTING
RESEARCH
SALES
OPERATIONS
SQL> select &&m1 from dept;
Enter value for m1: loc
old 1: select &&m1 from dept
new 1: select loc from dept
LOC
NEW YORK
DALLAS
CHICAGO
BOSTON
SQL> select &&m1 from dept;
old 1: select &&m1 from dept
new 1: select loc from dept
LOC
NEW YORK
DALLAS
CHICAGO
BOSTONIf you use single '&' then each time you fire the query, It will ask for the new value..
But if you will use double '&&' the value of m1 will be persistent across the session..
Twinkle
Maybe you are looking for
-
Mail.app on leopard crashes when Cmd-T (Fonts) invoked
Aloha gang - I have a problem with Mail.app under Leopard 10.5.4 (ever since 10.5.1 actually) on my iMac DualCore 24" system. Whenever I try to press Cmd-T for Format-Fonts I get a spinning beachball for 5 to 10 sec and then the entire app disappears
-
Facebook actionscript API not working with Flex 4.5 Mobile Project
Will the following API work in a Flex 4.5 mobile project? http://code.google.com/p/facebook-actionscript-api/ I tried a simple Facebook.int() and I keep getting the following error... Error: Error #2067: The ExternalInterface is not available in this
-
I can't print a doc in adobe reader x
I can't print a doc in adobe reader x
-
Argh! copy and pasting underlining everything....
help! i've built a site, but want to switch the elements from the current template to a new one. when i try and copy and paste; whether it's one word, or the whole page, the text is all underlined. i tried a new site, or doing pages within the same s
-
OS X Yosemite Screwed Up Internet
Is anybody else having the same issues as me. Ever since I update to the new OS X Yosemite, I'm having a hard time connecting to internet and do simple email that I could use to do faster with the previous OS X. The internet says Im not connected whe