Help-mandt declaration?
HI All,
I decalred constant like this.
constants: help-mandt(3) VALUE '000',
But it is giving error as below.
In Unicode programs, the "-" character cannot appear in names, as it does here in the name "HELP-MANDT".
How shall i declare it in ECC 6.0 (Unicode)
hi..pravin..
even iam using ecc.6.0.
here iam not getting any warning.
pls paste ur code here to check.
As above said, pls read the rules before declaring any varb in ABAP.
regards,
Padma,
for reference:
Local Data Types in Programs
All ABAP programs can define their own data types. Within a program, procedures [Page 449]
can also define local types.
You define local data types in a program using the
TYPES <t> ... [TYPE <type>|LIKE <obj>] ...
statement. The type name <t> may be up to 30 characters long. You can use any letters, digits,
and the underscore character. Do not create a name consisting entirely of numeric characters.
You cannot use the special characters + . , : ( ) - < >. Other special characters are reserved for
internal use. You cannot use the names of the predefined ABAP types (C, D, F, I, N, P, T, X,
STRING, XSTRING) or the name of the generic type TABLE. You should not use names that are
the same as an ABAP keyword or addition. You should:
Use names that explain the meaning of the type without the need for further comments
Use the underscore character to separate compound words
Always use a letter as the first character of a variable name.
You declare local data types in a program either by referring to an existing data type or
constructing a new type.
An existing type can be
A predefined ABAP type to which you refer using the TYPE addition
An existing local type in the program to which you refer using the TYPE addition
The data type of a local object in the program to which you refer using the LIKE addition
A data type in the ABAP Dictionary to which you refer using the TYPE addition. To ensure
compatibility with earlier releases, it is still possible to use the LIKE addition to refer to
database tables and flat structures in the ABAP Dictionary. However, you should use the
TYPE addition in new programs.
Known types must be visible [Page 112] at the point where you define the new type. If the
existing type is generic, you can use further additions to set the attributes of type <t> that are still
undefined.
Similar Messages
-
Hallow I decleare a field like <b>score_sum TYPE p DECIMALS 2</b>, and I dont now how to declare it in my <b>structure</b> in se 11.
regardsHi,
When you are creating the Structure, just click the <b>Built-in type</b> pushbutton, then it will allow you to enter the Data type , Length
Regards
Sudheer
Message was edited by:
Sudheer Junnuthula -
Help with Declaring a Class with a Method and Instantiating an Object
hello all i am having trouble understanding and completing a lab tutorial again!
im supposed to compile an run this code then save work to understand how to declare aclass with a method an instantiate an object of the class with the following code
// Program 1: GradeBook.java
// Class declaration with one method.
public class GradeBook
// display a welcome message to the GradeBook user
public void displayMessage()
System.out.println( "Welcome to the Grade Book!" );
} // end method displayMessage
} // end class GradeBook
// Program 2: GradeBookTest4.java
// Create a GradeBook object and call its displayMessage method.
public class GradeBookTest
// main method begins program execution
public static void main( String args[] )
// create a GradeBook object and assign it to myGradeBook
GradeBook myGradeBook = new GradeBook();
// call myGradeBook's displayMessage method
myGradeBook.displayMessage();
} // end main
} // end class GradeBookTest4
i saved above code as shown to working directory filename GradeBookTest4.java
C:\Program Files\Java\jdk1.6.0_11\bin but recieved error message
C:\Program Files\Java\jdk1.6.0_11\bin>javac GradeBook4a.java GradeBookTest4.java
GradeBookTest4.java:2: class, interface, or enum expected
^
GradeBookTest4.java:27: reached end of file while parsing
^
2 errors
can someone tell me where the errors are because for class or interface expected message i found a solution which says 'class? or 'interface' expected is because there is a missing { somewhere much earlier in the code. i dont know what "java:51: reached end of file while parsing " means or what to do to fix ,any ideas a re appreciatedDoesn't solve your problem, but this works for me...
public class GradeBook
public void displayMessage() {
System.out.println( "Welcome to the Grade Book!" );
public static void main( String args[] ) {
try {
GradeBook gradeBook = new GradeBook();
gradeBook.displayMessage();
} catch (Exception e) {
e.printStackTrace();
} -
Please help me urgently (Problem in using delete statement)
Hello,
I want to run delete query where table name should come from a variable .I have written the following procedure but its not working .Could you please help me
DECLARE
processtemplatename VARCHAR2(64);
CURSOR T1Cursor IS
select Process_template_name from ProcessTemplate
where PROCESS_template_ID in
( select PROCESS_template_ID from PROCESSINSTANCE
where process_instance_id in
(select process_instance_id from processinstance where STATUS = 'PI_COMPLETED' OR STATUS = 'PI_REMOVED' ));
BEGIN
OPEN T1Cursor;
LOOP
FETCH T1Cursor INTO processtemplatename;
EXIT WHEN T1Cursor%NOTFOUND;
DELETE FROM processtemplatename WHERE process_instance_id in
( select process_instance_id from PROCESSINSTANCE where STATUS = 'PI_COMPLETED' OR STATUS = 'PI_REMOVED' );
END LOOP;
CLOSE T1Cursor;
END;
I am getting the error
ERROR at line 19:
ORA-06550: line 19, column 27:
PL/SQL: ORA-00942: table or view does not exist
ORA-06550: line 19, column 15:
PL/SQL: SQL Statement ignored
even when i used
DECLARE
processtemplatename VARCHAR2(64);
BEGIN
processtemplatename := 'example1';
DELETE FROM processtemplatename WHERE process_instance_id in
( select process_instance_id from PROCESSINSTANCE where STATUS = 'PI_COMPLETED' OR STATUS = 'PI_REMOVED' );
END;
I am still getting the same error message
Thanks,
Salam.And BTW you do not need that clumsy CURSOR c.. OPEN c.. FETCH c INTO... CLOSE c etc. It is "reserved" for more complex cases when you cannot use:
<pre>
FOR P IN
select Process_template_name
from ProcessTemplate
where PROCESS_template_ID in
(select PROCESS_template_ID
from PROCESSINSTANCE
where process_instance_id in
(select process_instance_id
from processinstance
where STATUS = 'PI_COMPLETED'
OR STATUS = 'PI_REMOVED'
LOOP
EXECUTE IMMEDIATE
'DELETE FROM ' || P.Process_template_name ||
' WHERE process_instance_id in
(select process_instance_id
from PROCESSINSTANCE
where STATUS = ''PI_COMPLETED'' OR STATUS = ''PI_REMOVED''
END LOOP;
</pre> -
Multiple records in select options-Urgent help
Hi all,
Iam using the following function module to get the set values. I need to pass multiple values in select options(ie) select options with no intervals. to the function module parameter Shortname. I have declared the variable which has to be passed as
S_SETID FOR SETHEADER-SETNAME NO INTERVALS.
The problem is when i use S_SETID-LOW the value is passed to the function module , but if multiple data is entered in the input then how to pass all the data to the function module. Please Help.Hi,
Declare the Range in the Function module , then you can pass that Select-option fields to that ranges and use that in the Function module.
Or you can use the RANGE_C8 for the Select-optios in the Function module, you can declare the Internal table with the type of RANGE_C8 in the tables parameter, then pass the Select-option to this Internal table
If you want more length field then search based on RANGE_* then you will get all the Range Structure.
Regards
Sudheer -
Error in the following code.need help asap
hi i have written a block which bulk collects into a pl/sql table.
Getting an error as shown below.
PLz help asap
declare
type summary_upd_tab is table of summary%rowtype;
summary_upd_var summary_upd_tab;
begin
select
min(a.start_time_utc),
max(a.end_time_utc),
sum(duration_seconds),
sum(upload_bytes),
sum(download_bytes)
bulk collect into summary_upd_var ------GEETTING AN ERROR --TOO MANY VALUES???
from aaa_sessions a
group by user_id;
---,type_of_summary,ispeak;
end;
Edited by: user8731258 on Jul 20, 2010 10:16 PMi think the no. of columns should match(and that too in Order) else how will it know which value should go in which field of the collection ?
-
MS Access Cfquery or Cfstoredproc parameters declaration?
How do you pass more than one argument to MS Access stored procedure (query) using either CFQuery or CFStoredProc?
Environment: MS Access 2007; Coldfusion 7 Std Edition.
Working example CFQUERY with 1 date value parameter:
<cfquery name="testStoredProc" datasource="cinci_events">
EXEC qry_MenuByDate '2/1/2011'
</cfquery>
(Access query parameter name is "@dtmDate", but its inclusion in EXEC statement creates error).
But an otherwise-same-as query using 2nd date value parameter fails
Error Executing Database Query.
Syntax error (missing operator) in query expression ''2/1/2011' '2/2/2011''.
The error occurred in D:\ciweb\scripts\reservations\cf\dsp_CaféMenu_StoredProcedure3.cfm: line 59
57 : --->
58 : <p> datasource = {<cfoutput>cinci_events</cfoutput>}</p>
59 : <cfquery name="testStoredProc" datasource="cinci_events">
60 : EXEC qry_MenuByDateRange '2/1/2011' '2/2/2011'
61 : </cfquery>
Above query "knows" the existence of 2nd date value. Without a 2nd date, query errors with message:
Error Occurred While Processing Request
Error Executing Database Query.
Parameter [EndDate?] has no default value.
The error occurred in D:\ciweb\scripts\reservations\cf\dsp_CaféMenu_StoredProcedure3a.cfm: line 59
57 : --->
58 : <p> datasource = {<cfoutput>cinci_events</cfoutput>}</p>
59 : <cfquery name="testStoredProc" datasource="cinci_events">
60 : EXEC qry_MenuByDateRange '2/1/2011'
61 : </cfquery>
SQL
EXEC qry_MenuByDateRange '2/1/2011'
DATASOURCE
cinci_events
VENDORERRORCODE
3088
SQLSTATE
Resources:
I would prefer to use a Cfstoredproc method. But help with declaring multiple inputs for either is very much appreciated.
Thank, GuySeparating CFQUERY arguments with a comma corrects the error. I thought (?) I had tried comma separation in my iterations. Thanks.
Many unsuccessful iterations tried with CFSTOREDPROC. For example:
Error Occurred While Processing Request
Error Executing Database Query.
Invalid SQL statement; expected 'DELETE', 'INSERT', 'PROCEDURE', 'SELECT', or 'UPDATE'.
The error occurred in D:\ciweb\scripts\reservations\cf\dsp_CaféMenu_StoredProcedure23.cfm: line 65
63 : <cfstoredproc procedure = "qry_MenuByDate" DATASOURCE="cinci_events">
64 : <cfprocparam type="in" cfsqltype="CF_SQL_DATE" dbvarname="dtmDate" value='2/1/2011'>
65 : <cfprocresult name="testStoredProc">
66 : </cfstoredproc>
67 : <p>testStoredProc.RecordCount = {<cfoutput>#testStoredProc.RecordCount#</cfoutput>}</p>
SQL
{call qry_MenuByDate( (param 1) )}
DATASOURCE
cinci_events
VENDORERRORCODE
3092 -
How to declare the field if i want the output as 300.12,00
How to declare the fields if i want the output as 300.12,00
i have a quantity field so i need to place . in place of , and , inplace of .
please help mehi,
declare its as
CURR
field.
Regards
Anver -
I Need Help with the LOGON Built-in
Hello I have the following problem, I have a code implemented in the trigger ON-LOGON I will show them the code.
DECLARE
--Numero de Intentos Permitidos
num_intentos NUMBER :=3;
--Variables de Coneccion
usu VARCHAR2(80);
pass VARCHAR2(80);
conec VARCHAR2(80);
upc VARCHAR2(200);
coneccion BOOLEAN:=FALSE;
--Numero de Erro
num_error NUMBER;
BEGIN
--Ciclo que controla el numero de intentos
FOR i IN 1..num_intentos
LOOP
--Muestra la pantalla logon de Oracle Forms
LOGON_SCREEN;
--Se recupera los valores de la coneccion.
usu := GET_APPLICATION_PROPERTY(USERNAME);
pass := GET_APPLICATION_PROPERTY(PASSWORD);
conec := GET_APPLICATION_PROPERTY(CONNECT_STRING);
--Digito Cancel
IF NOT FORM_SUCCESS THEN
k_mensajes.push('No es posible establecer la Coneccion, Contacte con el Administrador del Sistema','E');
EXIT;
END IF;
--Se Desconecta cualquier session
LOGOUT;
--Verificamos que los datos de coneccion no esten nulos
IF ((usu IS NULL) AND (pass IS NULL) AND (conec IS NULL)) THEN
k_mensajes.push('Los Datos para establecer la Coneccion estan incompletos','E');
RETURN;
END IF;
--Realizando la coneccion
IF ((usu IS NOT NULL) AND (pass IS NOT NULL) AND (conec IS NOT NULL)) THEN
LOGON(usu,pass||'@'||conec,FALSE);
num_error:=DBMS_ERROR_CODE;
ELSE
LOGON(usu,pass,FALSE);
num_error:=DBMS_ERROR_CODE;
coneccion :=FALSE;
END IF;
RETURN;
--Finalizando el Ciclo
END LOOP;
IF NOT coneccion THEN
RAISE FORM_TRIGGER_FAILURE;
END IF;
END;
The problem is that when I capture the the I number of error, I pass it to the ON-ERROR and of there I verify that I number of error it is and I throw the message, but I am not able to contralar the sequence among the triggers.
I will show them the code of the trigger ON-ERROR:
DECLARE
--Numero de Error
num_error NUMBER;
BEGIN
num_error:=DBMS_ERROR_CODE;
--Se Verifica el Tipo de Error
IF num_error= -1017 THEN
--El Usuario ingreso mal la contraseña
k_mensajes.push('El Password Ingresado no es Valido.','E');
LOGON_SCREEN;
ELSIF num_error= -28000 THEN
--El Usuario esta Bloqueado
k_mensajes.push('El Usuario esta Bloqueado, Contacte con el Administrador del Sistema.','E');
ELSIF num_error= -28002 THEN
--La Contraseña del Usuario ha Expirado
k_mensajes.push('Su Password va Expirar, favor cambiarla antes de que Expire.','E');
CALL_FORM (lower('S_SEG_CAMBPASS'),NO_HIDE,DO_REPLACE);
--======> Cuando el valor es 0 indica que la coneccion fue establecida <=====
ELSIF num_error= 0 OR num_error IS NULL THEN
NULL;
--======>Cuando el valor es -24309 hay una sesion conectada, se realiza la desconeccion de esa sesion. <======
ELSIF num_error= -24309 THEN
NULL;
LOGOUT;
ELSIF num_error= -1403 THEN
NULL;
ELSE
--Si es otro error
k_mensajes.push('Error al Ingresar '||TO_CHAR(num_error)||', Contacte con el Administrador del Sistema','E');
NULL;
END IF;
END;
If somebody can help me or to indicate me where this my error, because I need to look for the way to tell to the user that this blocked, or that I enter bad their password.Hi!
I think this will help us:
declare
--Numero de Intentos Permitidos == number of allowed ....
num_intentos number := 3;
--Variables de Coneccion == connection variables
usu varchar2( 80 );
pass varchar2( 80 );
conec varchar2( 80 );
upc varchar2( 200 );
coneccion boolean := false;
num_error number;
begin
--Ciclo que controla el numero de intentos
for i in 1 .. num_intentos
loop
--show Oracle Forms logon screen
logon_screen;
--save connection settings
usu := get_application_property( username );
pass := get_application_property( password );
conec := get_application_property( connect_string );
-- Exit the loop
if not form_success
then
k_mensajes.push
( 'No es posible establecer la Coneccion, Contacte con el Administrador del Sistema'
, 'E' );
exit;
end if;
-- Disconnect
logout;
-- Test for null values
if ( ( usu is null )
and ( pass is null )
and ( conec is null ) )
then
k_mensajes.push( 'Los Datos para establecer la Coneccion estan incompletos'
, 'E' );
return;
end if;
-- now make the connection
if ( ( usu is not null )
and ( pass is not null )
and ( conec is not null ) )
then
logon(
usu
, pass || '@' || conec
, false );
num_error := dbms_error_code;
else
logon(
usu
, pass
, false );
num_error := dbms_error_code;
coneccion := false;
end if;
return;
end loop;
if not coneccion
then
raise form_trigger_failure;
end if;
end;And then:
declare
num_error number;
begin
num_error := dbms_error_code;
-- discern error type
if num_error = -1017
then
--password entered is invalid
k_mensajes.push( 'El Password Ingresado no es Valido.', 'E' );
logon_screen;
elsif num_error = -28000
then
--user is blocked
k_mensajes.push
( 'El Usuario esta Bloqueado, Contacte con el Administrador del Sistema.'
, 'E' );
elsif num_error = -28002
then
--password is expired
k_mensajes.push( 'Su Password va Expirar, favor cambiarla antes de que Expire.'
, 'E' );
call_form(
lower( 'S_SEG_CAMBPASS' )
, no_hide
, do_replace );
--======> 0 means that the connection was succesfully made <=====
elsif num_error = 0
or num_error is null
then
null;
--======>Cuando el valor es -24309 hay una sesion conectada, se realiza la desconeccion de esa sesion. <======
-- think this means something like 'there is a connection, but we have to end it'
elsif num_error = -24309
then
null;
logout;
elsif num_error = -1403
then
null;
else
--other error
k_mensajes.push('Error al Ingresar '
|| to_char( num_error )
|| ', Contacte con el Administrador del Sistema'
, 'E' );
null;
end if;
end;In you on-logon trigger you have entered some return statements. These will omit you last segment of code:
if not coneccion
then
raise form_trigger_failure;
end if;I don't think you want to skip this. but then again, this is a confusing segment as well:
else
logon(
usu
, pass
, false );
num_error := dbms_error_code;
coneccion := false;
end if;You make a connection but then you set the variable 'coneccion' to false. Why?
Furthermore, I am not sure that form_success gives you the info you want. It will only tell you whether the very last statement before the call to form_succes, was successfull. In your case, that is
conec := get_application_property( connect_string );which, I believe, will not fail in your code.
Hope this helps!
Grtx
Remco -
Dear gurus,
I need ur help in declaration of WORKAREA in alv.
am trying but its throwing error(slis_t_fieldcat_alv is unknown
and its either one of the specified tables not defined by the data)
am writng the program below..
(type-pools slis .
tables : kna1.
types : gitab type table of zguru.
data : itab type gitab.
data : wa type itab .
data : head like slis_t_fieldcat_alv.
select
kunnr
land1
name1
from kna1 into table itab up to 100 rows.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = sy-repid
I_INTERNAL_TABNAME = ITAB
I_STRUCTURE_NAME =
I_CLIENT_NEVER_DISPLAY = 'X'
I_INCLNAME = sy-redid
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
CHANGING
CT_FIELDCAT = head
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = sy-repid
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT =
IT_FIELDCAT = head
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
I_HTML_HEIGHT_TOP =
I_HTML_HEIGHT_END =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = ITAB
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.)Hi,
Use this code.....
type-pools slis .
tables : kna1.
types : gitab type table of zguru.
data : itab type gitab.
data : wa type itab .
data : head type slis_t_fieldcat_alv.
select
kunnr
land1
name1
from kna1 into table itab up to 100 rows.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = sy-repid
I_INTERNAL_TABNAME = ITAB
I_CLIENT_NEVER_DISPLAY = 'X'
I_INCLNAME = sy-redid
I_BYPASSING_BUFFER = CHANGING
CT_FIELDCAT = head
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = sy-repid
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_BACKGROUND_ID = ' '
IT_FIELDCAT = head
I_DEFAULT = 'X'
I_SAVE = ' '
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
TABLES
T_OUTTAB = ITAB
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Hope it will helps -
Can anyone help me to amend the SQL below?
I do not know how to implement roles application in the Oracle Forms, so I have tried to use the below SQL to tackle this problem. The code below can be compiled successfull but its application of open form () cannot work. Can anyone help ?
DECLARE
rg_id RECORDGROUP;
rg_name VARCHAR2(30);
ret_code NUMBER;
BEGIN
rg_name := 'RG_LIST';
rg_id := FIND_GROUP(rg_name);
IF NOT ID_NULL(rg_id) THEN
DELETE_GROUP(rg_id);
END IF;
rg_id :=CREATE_GROUP_FROM_QUERY( rg_name,'SELECT PASSWORD, into
password_value FROM STAFF WHERE STAFF.LOGIN_ID =:LOGIN.LOGIN_ID');
ret_code := POPULATE_GROUP( rg_id );
--IF (ret_code <> 0) THEN
-- Message ('no such user');
-- RAISE FORM_TRIGGER_FAILURE;
--END IF;
if (:Login.password =
Get_Group_Char_Cell(rg_name||'password_value',1)) THEN
open_form('trans_tab');
end if;
end;Note that you may have more luck posting this sort of Forms-specific question in the Oracle Forms group.
Justin
Distributed Database Consulting, Inc.
http://www.ddbcinc.com/askDDBC -
SQL help - Parse Hyphen delimited text from UDF
Dear Experts,
I am experiencing a challenge that I hope you can help me with.
I have a requirement to create several separate UDF's to be populated with information from another UDF.
It uses a hyphen delimited string and I need to parse the different positions within the string.
Here is an example
UDF containing string
123-456-789-abc
needs to be queried to populate four UDFs separately.
UDF1 = 123
UDF2 = 456
UDF3 = 789
UDF4 = abc
There is no set number of characters in each segment as they are not based on a set criteria.
I have found ways to do this in SQL when not using the query generator however, I am given an 'Invalid Cursor' error whenever I attempt to use the code in B1 query generator
Thanks in advance and kind regards,
LucasGordon,
This is the base statement I am trying to customize and build off of.
My assumption, is that if I can get this piece working in B1, I can modify with SAP object references and return the correct data for each UDF.
However, I may be going about this the wrong way, and I am definitely open to suggestions.
Thanks for any help,
Lucas
declare @string varchar(500)
set @string = 'ABC-DEF-GHIJK-LMNOPQRS-T-UV'
declare @pos int
declare @piece varchar(500)
if right(rtrim(@string),1) <> '-'
set @string = @string + '-'
set @pos = patindex('%-%' , @string)
while @pos <> 0
begin
set @piece = left(@string, @pos - 1)
print cast(@piece as varchar(500))
set @string = stuff(@string, 1, @pos, '')
set @pos = patindex('%-%' , @string)
end -
Help with using variable for name of table in PLSQL block...
I am trying to use a variable for the name of a table but getting errors ...i am sure I am close to the correct form here but something is wrong. I sure would appreciate some help!
DECLARE
ln_month Number;
ln_day Number;
ln_year Number;
ls_year VarChar2(4);
ls_prev_table VarChar2(30);
ls_cur_table VarChar2(30);
ln_prev_year Number;
ls_prev_year VarChar2(4);
ln_prev_month Number;
BEGIN
Select To_Number(To_Char(sysdate, 'MM')) into ln_month from dual;
Select To_Number(To_Char(sysdate, 'DD')) into ln_day from dual;
Select To_Number(To_Char(sysdate, 'YYYY')) into ln_year from dual;
If ln_month = 01 Then
ls_cur_table := "T_CPRS_FDW_CUR_JAN_ACTUALS";
ls_prev_table := "T_CPRS_FDW_PREV_DEC_ACTUALS";
ln_prev_year := ln_year - 1;
/***above is where I am trying to use variables for assignement to years and months tables***//// ln_prev_month := 12;
End If;
/*------MORE IF STATEMENTS FOR EACH MONTH ---OF --THE YEAR ...AND its the following 2 variable statements that the compiler doesnt like! */
If ln_day < 20 Then
Delete from :ls_prev_table;
INSERT INTO :ls_prev_table /*(STUFF TO BE INSERTED GOES HERE)*/
HELP PLEASE!
nullHi,
The parser does not under variables directly in dml statements.u need to form a statement and the parse and execute the same...
so the soln is
Declare
lv_stmt varchar2(250);
Begin
lv_stmt := 'Delete from '| |ls_prev_table;
execute immediate lv_stmt;
-- Same is the case with the insert stmt--
End;
This should solve ur problem.
u could also give a direct call like
execute immediate 'Delete from '| |ls_prev_table ;
Note: This statement "execute immediate" holds good for oracle versions 8.x and above which makes the stmt very simple. For lower version u need to use the dbms_sql package to parse and execute the statement which has a series of statements for the same.
Kiran -
Looking for suggestion/idea/help WITH T-SQL
Hi all,
The scenario I have is a person can have one or more charges on his/her case.
One charge could be adjudicated as GUILTY and the other charge
is DROPPED. If this is the scenario, I would like to assign GUILTY Adjudication to this case.
OR
One charge could be WITHHELD and the other charge is DROPPED.
If this is the scenario, I would like to assign WITHHELD to this case.
Under Adjudication column, I would like to see GUILTY for case number 12345 and WITHHELD for case 98765
Sample data:
Case Number Charge Charge
Adjudication
Disposition
========== ====== ===========
============
12345 DUI
GUILTY
12345 Driving w/o license DROPPED
98765 DUI
WITHHELD
98765 Driving w/o license DROPPED
Below is the query that returned the above sample Charge Disposition. I am thinking of using CASE expression to determine Adjudication but not sure.
Thank you for everyone's help!
declare @Begindate datetime--
declare @Enddate datetime
set @begindate = '05/01/2014'
set @Enddate = '05/31/2014'
SELECT
(CASE
WHEN cc1.ProsecutorFinalAction IN ('L','O','R') AND
(cc1.ProsecutorFinalDecisionDate >= @BeginDate) AND
(cc1.ProsecutorFinalDecisionDate < DateAdd(d, 1, @EndDate))
THEN pfa1.Description
WHEN (cc1.CourtDecisionDate >= @BeginDate)AND
(cc1.CourtDecisionDate < DateAdd(d, 1, @EndDate))
THEN dbo.fnGetLookupDescription(cc1.CourtActionTaken,'CourtActionTaken')
END)
FROM tblCase c1 with(nolock)
INNER JOIN tblCaseCharge cc1 with(nolock)
ON c1.caseid = cc1.caseid
LEFT OUTER JOIN tblProsecutorFinalAction pfa1 WITH(NOLOCK)
ON cc1.ProsecutorFinalAction = pfa1.ProsecutorCode
WHERE c1.CaseID = @CaseIDIf you want to return just one row for each case, then:
;with cte as (SELECT *, ROW_NUMBER() over (PARTITION BY case_number
ORDER BY case [Charge Disposition] WHEN 'GUILTY' then 1 WHEN 'WITHHELD' ELSE 3 END) AS RN
FROM CasesInfo)
SELECT * FROM cte WHERE Rn = 1 -- will select rows with GUILTY status or WITHHELD status
and not dropped status
For every expert, there is an equal and opposite expert. - Becker's Law
My blog
My TechNet articles -
SQL/PLSQL Help - Table Name and Count on same line
Hello,
I need the following information returned:
Table_Name, Current Table Count, Num_Rows.
The table_name and num_rows are pulled from dba_tables where owner = 'XXXX'
I can't figure out how to return this info.
Sample of desired output and format
Table_name Num_Rows Current Count
AAAA 15 400
ABBB 8000 8120
Any help would be appreciated.
Thanks - ChrisMay be this one helps you:
declare
cursor cur_cnt is
select 'select ''' || table_name || ''', (select count(*) from ' || table_name || ') from dual' l_sql from user_tables;
l_table_name varchar2(30);
l_cnt number;
begin
dbms_output.put_line(rpad('Table Name',40)||rpad('RowCount',40));
dbms_output.put_line('------------------------------------------------');
for l_cur_cnt in cur_cnt
loop
execute immediate l_cur_cnt.l_sql into l_table_name, l_cnt;
dbms_output.put_line(rpad(l_table_name,40)
||rpad(l_cnt,40));
end loop;
end;
-Hari
Hello,
I need the following information returned:
Table_Name, Current Table Count, Num_Rows.
The table_name and num_rows are pulled from dba_tables where owner = 'XXXX'
I can't figure out how to return this info.
Sample of desired output and format
Table_name Num_Rows Current Count
AAAA 15 400
ABBB 8000 8120
Any help would be appreciated.
Thanks - Chris
Maybe you are looking for
-
How to override to_number function?!
Hi, I already tried to find an answer by searching this forum but without success... My problem is, that I have a lot of mappings using the to_number() function to convert char into number. Now it turns out, that in some cases - due to the bad data q
-
Hello and thank you in advance for your help. I am building a website for a small business and following various tutorials etc to help me along the way. I have created a menu bar within the banner with hover formatting etc. but in IE it fails to sh
-
can any provide information on BPM design pattern and give examples scenarios. thank you
-
FW 7.3.x Factory Reset procedures have changed
A lot of people can't return their new Airport Express back to their default factory settings. That's because the factory reset procedures have changed. The old "press and hold the reset button when plugging in until green light flashes four times" n
-
Is pl/sql programming language compiler or interpreter language?
Hello guys, Is pl/sql programming language compiler or interpreter language? Thanks Edited by: Polat on 14.Mar.2012 09:09